Cody

# Problem 42615. Factorizing a number into a given number of factors

Solution 3080956

Submitted on 6 Oct 2020
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   Fail
n = 30; b = 1; A_correct = [ 30 ]; assert(isequal(LtdFactor(n,b),A_correct))

d = 1 2 3 5 6 10 15 30

Output argument "M" (and maybe others) not assigned during call to "LtdFactor". Error in Test1 (line 4) assert(isequal(LtdFactor(n,b),A_correct))

2   Fail
n = 3135; b = 2; A_correct = [ 1 3135 ; 3 1045 ; 5 627 ; 11 285 ; 15 209 ; 19 165 ; 33 95 ; 55 57 ]; assert(isequal(LtdFactor(n,b),A_correct))

d = Columns 1 through 14 1 3 5 11 15 19 33 55 57 95 165 209 285 627 Columns 15 through 16 1045 3135

Output argument "M" (and maybe others) not assigned during call to "LtdFactor". Error in Test2 (line 4) assert(isequal(LtdFactor(n,b),A_correct))

3   Fail
n = 120; b = 3; A_correct = [ 1 1 120 ; 1 2 60 ; 1 3 40 ; 1 4 30 ; 1 5 24 ; 1 6 20 ; 1 8 15 ; 1 10 12 ; 2 2 30 ; 2 3 20 ; 2 4 15 ; 2 5 12 ; 2 6 10 ; 3 4 10 ; 3 5 8 ; 4 5 6 ]; assert(isequal(LtdFactor(n,b),A_correct))

d = 1 2 3 4 5 6 8 10 12 15 20 24 30 40 60 120

Output argument "M" (and maybe others) not assigned during call to "LtdFactor". Error in Test3 (line 4) assert(isequal(LtdFactor(n,b),A_correct))

4   Fail
n = 420; b = 4; A_correct = [ 1 1 1 420 ; 1 1 2 210 ; 1 1 3 140 ; 1 1 4 105 ; 1 1 5 84 ; 1 1 6 70 ; 1 1 7 60 ; 1 1 10 42 ; 1 1 12 35 ; 1 1 14 30 ; 1 1 15 28 ; 1 1 20 21 ; 1 2 2 105 ; 1 2 3 70 ; 1 2 5 42 ; 1 2 6 35 ; 1 2 7 30 ; 1 2 10 21 ; 1 2 14 15 ; 1 3 4 35 ; 1 3 5 28 ; 1 3 7 20 ; 1 3 10 14 ; 1 4 5 21 ; 1 4 7 15 ; 1 5 6 14 ; 1 5 7 12 ; 1 6 7 10 ; 2 2 3 35 ; 2 2 5 21 ; 2 2 7 15 ; 2 3 5 14 ; 2 3 7 10 ; 2 5 6 7 ; 3 4 5 7 ]; assert(isequal(LtdFactor(n,b),A_correct))

d = 1 2 3 4 5 6 7 10 12 14 15 20 21 28 30 35 42 60 70 84 105 140 210 420

Output argument "M" (and maybe others) not assigned during call to "LtdFactor". Error in Test4 (line 4) assert(isequal(LtdFactor(n,b),A_correct))

5   Fail
n = 2025; b = 3; A_correct = [ 1 1 2025 ; 1 3 675 ; 1 5 405 ; 1 9 225 ; 1 15 135 ; 1 25 81 ; 1 27 75 ; 1 45 45 ; 3 3 225 ; 3 5 135 ; 3 9 75 ; 3 15 45 ; 3 25 27 ; 5 5 81 ; 5 9 45 ; 5 15 27 ; 9 9 25 ; 9 15 15 ]; assert(isequal(LtdFactor(n,b),A_correct))

d = Columns 1 through 14 1 3 5 9 15 25 27 45 75 81 135 225 405 675 Column 15 2025

Output argument "M" (and maybe others) not assigned during call to "LtdFactor". Error in Test5 (line 4) assert(isequal(LtdFactor(n,b),A_correct))

6   Fail
n = 210; b = 4; A_correct = [ 1 1 1 210 ; 1 1 2 105 ; 1 1 3 70 ; 1 1 5 42 ; 1 1 6 35 ; 1 1 7 30 ; 1 1 10 21 ; 1 1 14 15 ; 1 2 3 35 ; 1 2 5 21 ; 1 2 7 15 ; 1 3 5 14 ; 1 3 7 10 ; 1 5 6 7 ; 2 3 5 7 ]; assert(isequal(LtdFactor(n,b),A_correct))

d = 1 2 3 5 6 7 10 14 15 21 30 35 42 70 105 210

Output argument "M" (and maybe others) not assigned during call to "LtdFactor". Error in Test6 (line 4) assert(isequal(LtdFactor(n,b),A_correct))

### Community Treasure Hunt

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

Start Hunting!