Cody

Problem 2721. Pandigital Factors (Based on Euler 491)

Solution 2653592

Submitted on 5 Jul 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
x = 4;y=7; y_correct = 13; assert(isequal(pandigit_factors(x,y),y_correct));

s = 4 3 2 1 0 4 3 2 0 1 4 3 1 2 0 4 3 1 0 2 4 3 0 2 1 4 3 0 1 2 4 2 3 1 0 4 2 3 0 1 4 2 1 3 0 4 2 1 0 3 4 2 0 3 1 4 2 0 1 3 4 1 3 2 0 4 1 3 0 2 4 1 2 3 0 4 1 2 0 3 4 1 0 3 2 4 1 0 2 3 4 0 3 2 1 4 0 3 1 2 4 0 2 3 1 4 0 2 1 3 4 0 1 3 2 4 0 1 2 3 3 4 2 1 0 3 4 2 0 1 3 4 1 2 0 3 4 1 0 2 3 4 0 2 1 3 4 0 1 2 3 2 4 1 0 3 2 4 0 1 3 2 1 4 0 3 2 1 0 4 3 2 0 4 1 3 2 0 1 4 3 1 4 2 0 3 1 4 0 2 3 1 2 4 0 3 1 2 0 4 3 1 0 4 2 3 1 0 2 4 3 0 4 2 1 3 0 4 1 2 3 0 2 4 1 3 0 2 1 4 3 0 1 4 2 3 0 1 2 4 2 4 3 1 0 2 4 3 0 1 2 4 1 3 0 2 4 1 0 3 2 4 0 3 1 2 4 0 1 3 2 3 4 1 0 2 3 4 0 1 2 3 1 4 0 2 3 1 0 4 2 3 0 4 1 2 3 0 1 4 2 1 4 3 0 2 1 4 0 3 2 1 3 4 0 2 1 3 0 4 2 1 0 4 3 2 1 0 3 4 2 0 4 3 1 2 0 4 1 3 2 0 3 4 1 2 0 3 1 4 2 0 1 4 3 2 0 1 3 4 1 4 3 2 0 1 4 3 0 2 1 4 2 3 0 1 4 2 0 3 1 4 0 3 2 1 4 0 2 3 1 3 4 2 0 1 3 4 0 2 1 3 2 4 0 1 3 2 0 4 1 3 0 4 2 1 3 0 2 4 1 2 4 3 0 1 2 4 0 3 1 2 3 4 0 1 2 3 0 4 1 2 0 4 3 1 2 0 3 4 1 0 4 3 2 1 0 4 2 3 1 0 3 4 2 1 0 3 2 4 1 0 2 4 3 1 0 2 3 4

Output argument "pf" (and maybe others) not assigned during call to "pandigit_factors". Error in Test1 (line 3) assert(isequal(pandigit_factors(x,y),y_correct));

2   Fail
x = 3;y=3; y_correct = 18; assert(isequal(pandigit_factors(x,y),y_correct));

s = 3 2 1 0 3 2 0 1 3 1 2 0 3 1 0 2 3 0 2 1 3 0 1 2 2 3 1 0 2 3 0 1 2 1 3 0 2 1 0 3 2 0 3 1 2 0 1 3 1 3 2 0 1 3 0 2 1 2 3 0 1 2 0 3 1 0 3 2 1 0 2 3

Output argument "pf" (and maybe others) not assigned during call to "pandigit_factors". Error in Test2 (line 3) assert(isequal(pandigit_factors(x,y),y_correct));

3   Fail
x = 8;y=8; y_correct = 45360; assert(isequal(pandigit_factors(x,y),y_correct));

s = 8 7 6 5 4 3 2 1 0 8 7 6 5 4 3 2 0 1 8 7 6 5 4 3 1 2 0 8 7 6 5 4 3 1 0 2 8 7 6 5 4 3 0 2 1 8 7 6 5 4 3 0 1 2 8 7 6 5 4 2 3 1 0 8 7 6 5 4 2 3 0 1 8 7 6 5 4 2 1 3 0 8 7 6 5 4 2 1 0 3 8 7 6 5 4 2 0 3 1 8 7 6 5 4 2 0 1 3 8 7 6 5 4 1 3 2 0 8 7 6 5 4 1 3 0 2 8 7 6 5 4 1 2 3 0 8 7 6 5 4 1 2 0 3 8 7 6 5 4 1 0 3 2 8 7 6 5 4 1 0 2 3 8 7 6 5 4 0 3 2 1 8 7 6 5 4 0 3 1 2 8 7 6 5 4 0 2 3 1 8 7 6 5 4 0 2 1 3 8 7 6 5 4 0 1 3 2 8 7 6 5 4 0 1 2 3 8 7 6 5 3 4 2 1 0 8 7 6 5 3 4 2 0 1 8 7 6 5 3 4 1 2 0 8 7 6 5 3 4 1 0 2 8 7 6 5 3 4 0 2 1 8 7 6 5 3 4 0 1 2 8 7 6 5 3 2 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3 5 2 1 0 8 7 6 4 3 5 2 0 1 8 7 6 4 3 5 1 2 0 8 7 6 4 3 5 1 0 2 8 7 6 4 3 5 0 2 1 8 7 6 4 3 5 0 1 2 8 7 6 4 3 2 5 1 0 8 7 6 4 3 2 5 0 1 8 7 6 4 3 2 1 5 0 8 7 6 4 3 2 1 0 5 8 7 6 4 3 2 0 5 1 8 7 6 4 3 2 0 1 5 8 7 6 4 3 1 5 2 0 8 7 6 4 3 1 5 0 2 8 7 6 4 3 1 2 5 0 8 7 6 4 3 1 2 0 5 8 7 6 4 3 1 0 5 2 8 7 6 4 3 1 0 2 5 8 7 6 4 3 0 5 2 1 8 7 6 4 3 0 5 1 2 8 7 6 4 3 0 2 5 1 8 7 6 4 3 0 2 1 5 8 7 6 4 3 0 1 5 2 8 7 6 4 3 0 1 2 5 8 7 6 4 2 5 3 1 0 8 7 6 4 2 5 3 0 1 8 7 6 4 2 5 1 3 0 8 7 6 4 2 5 1 0 3 8 7 6 4 2 5 0 3 1 8 7 6 4 2 5 0 1 3 8 7 6 4 2 3 5 1 0 8 7 6 4 2 3 5 0 1 8 7 6 4 2 3 1 5 0 8 7 6 4 2 3 1 0 5 8 7 6 4 2 3 0 5 1 8 7 6 4 2 3 0 1 5 8 7 6 4 2 1 5 3 0 8 7 6 4 2 1 ...

Output argument "pf" (and maybe others) not assigned during call to "pandigit_factors". Error in Test3 (line 3) assert(isequal(pandigit_factors(x,y),y_correct));

4   Fail
j=[600 312 600 144 216 312 75 74 0 120 0 144 55]; x=5;y=ceil(13*rand) assert(isequal(pandigit_factors(x,y),j(y)));

y = 11 s = 5 4 3 2 1 0 5 4 3 2 0 1 5 4 3 1 2 0 5 4 3 1 0 2 5 4 3 0 2 1 5 4 3 0 1 2 5 4 2 3 1 0 5 4 2 3 0 1 5 4 2 1 3 0 5 4 2 1 0 3 5 4 2 0 3 1 5 4 2 0 1 3 5 4 1 3 2 0 5 4 1 3 0 2 5 4 1 2 3 0 5 4 1 2 0 3 5 4 1 0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error in Test4 (line 3) assert(isequal(pandigit_factors(x,y),j(y)));

5   Fail
x=1;y=10; assert(isequal(pandigit_factors(x,y),x));

s = 1 0

Output argument "pf" (and maybe others) not assigned during call to "pandigit_factors". Error in Test5 (line 2) assert(isequal(pandigit_factors(x,y),x));