Cody

Problem 191. Proper Factors

Solution 2024996

Submitted on 17 Nov 2019 by Doan Quang Manh
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
assert(isequal(pfactors(5),[]))

a = 5

2   Pass
assert(isequal(pfactors(10),[2 5]))

a = 2 5 y = 5 2 y = 2 5 y = 2 5 1 10 y = 2 5 1 10 2 5 y = 2 5 1 10 2 5 5 2 y = 1 2 5 10 y = 2 5 10 y = 2 5

3   Pass
assert(isequal(pfactors(12),[2 3 4 6]))

a = 2 2 3 y = 6 6 4 y = 2 3 4 6 y = 2 3 4 6 1 12 y = 2 3 4 6 1 12 2 6 y = 2 3 4 6 1 12 2 6 3 4 y = 2 3 4 6 1 12 2 6 3 4 4 3 y = 2 3 4 6 1 12 2 6 3 4 4 3 6 2 y = 1 2 3 4 6 12 y = 2 3 4 6 12 y = 2 3 4 6

4   Pass
assert(isequal(pfactors(15432),[2 3 4 6 8 12 24 643 1286 1929 2572 3858 5144 7716]))

a = 2 2 2 3 643 y = 7716 7716 7716 5144 24 y = 2 3 24 643 5144 7716 y = 2 3 24 643 5144 7716 1 15432 y = 2 3 24 643 5144 7716 1 15432 2 7716 y = 2 3 24 643 5144 7716 1 15432 2 7716 3 5144 y = 2 3 24 643 5144 7716 1 15432 2 7716 3 5144 4 3858 y = Columns 1 through 15 2 3 24 643 5144 7716 1 15432 2 7716 3 5144 4 3858 6 Column 16 2572 y = Columns 1 through 15 2 3 24 643 5144 7716 1 15432 2 7716 3 5144 4 3858 6 Columns 16 through 18 2572 8 1929 y = Columns 1 through 15 2 3 24 643 5144 7716 1 15432 2 7716 3 5144 4 3858 6 Columns 16 through 20 2572 8 1929 12 1286 y = Columns 1 through 15 2 3 24 643 5144 7716 1 15432 2 7716 3 5144 4 3858 6 Columns 16 through 22 2572 8 1929 12 1286 24 643 y = Columns 1 through 15 2 3 24 643 5144 7716 1 15432 2 7716 3 5144 4 3858 6 Columns 16 through 24 2572 8 1929 12 1286 24 643 643 24 y = Columns 1 through 15 2 3 24 643 5144 7716 1 15432 2 7716 3 5144 4 3858 6 Columns 16 through 26 2572 8 1929 12 1286 24 643 643 24 1286 12 y = Columns 1 through 15 2 3 24 643 5144 7716 1 15432 2 7716 3 5144 4 3858 6 Columns 16 through 28 2572 8 1929 12 1286 24 643 643 24 1286 12 1929 8 y = Columns 1 through 15 2 3 24 643 5144 7716 1 15432 2 7716 3 5144 4 3858 6 Columns 16 through 30 2572 8 1929 12 1286 24 643 643 24 1286 12 1929 8 2572 6 y = Columns 1 through 15 2 3 24 643 5144 7716 1 15432 2 7716 3 5144 4 3858 6 Columns 16 through 30 2572 8 1929 12 1286 24 643 643 24 1286 12 1929 8 2572 6 Columns 31 through 32 3858 4 y = Columns 1 through 15 2 3 24 643 5144 7716 1 15432 2 7716 3 5144 4 3858 6 Columns 16 through 30 2572 8 1929 12 1286 24 643 643 24 1286 12 1929 8 2572 6 Columns 31 through 34 3858 4 5144 3 y = Columns 1 through 15 2 3 24 643 5144 7716 1 15432 2 7716 3 5144 4 3858 6 Columns 16 through 30 2572 8 1929 12 1286 24 643 643 24 1286 12 1929 8 2572 6 Columns 31 through 36 3858 4 5144 3 7716 2 y = Columns 1 through 15 1 2 3 4 6 8 12 24 643 1286 1929 2572 3858 5144 7716 Column 16 15432 y = 2 3 4 6 8 12 24 643 1286 1929 2572 3858 5144 7716 15432 y = 2 3 4 6 8 12 24 643 1286 1929 2572 3858 5144 7716

Suggested Problems

More from this Author56

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!