Cody

Problem 2323. Pandigital number n°3 (Inspired by Project Euler 32)

Solution 2156490

Submitted on 11 Mar 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   Pass
x = 3; y_correct = []; assert(isequal(pandigital_sum(x),y_correct))

a = 3 b = 2 c = 1 a = 3 b = 1 c = 2 a = 2 b = 3 c = 1 a = 2 b = 1 c = 3 a = 1 b = 3 c = 2 a = 1 b = 2 c = 3

2   Fail
x = 4; y_correct = 12; assert(isequal(pandigital_sum(x),y_correct))

a = 4 b = 3 c = 2 1 a = 4 b = 3 2 c = 1 a = 43 b = 20 2 c = 10 1 a = 4 b = 3 c = 1 2 a = 4 b = 3 1 c = 2 a = 43 b = 10 1 c = 20 2 a = 4 b = 2 c = 3 1 a = 4 b = 2 3 c = 1 a = 42 b = 30 3 c = 10 1 a = 4 b = 2 c = 1 3 a = 4 b = 2 1 c = 3 a = 42 b = 10 1 c = 30 3 a = 4 b = 1 c = 3 2 a = 4 b = 1 3 c = 2 a = 41 b = 30 3 c = 20 2 a = 4 b = 1 c = 2 3 a = 4 b = 1 2 c = 3 a = 41 b = 20 2 c = 30 3 a = 3 b = 4 c = 2 1 a = 3 b = 4 2 c = 1 a = 34 b = 20 2 c = 10 1 a = 3 b = 4 c = 1 2 a = 3 b = 4 1 c = 2 a = 34 b = 10 1 c = 20 2 a = 3 b = 2 c = 4 1 a = 3 b = 2 4 c = 1 a = 32 b = 40 4 c = 10 1 a = 3 b = 2 c = 1 4 a = 3 b = 2 1 c = 4 a = 32 b = 10 1 c = 40 4 a = 3 b = 1 c = 4 2 a = 3 b = 1 4 c = 2 a = 31 b = 40 4 c = 20 2 a = 3 b = 1 c = 2 4 a = 3 b = 1 2 c = 4 a = 31 b = 20 2 c = 40 4 a = 2 b = 4 c = 3 1 a = 2 b = 4 3 c = 1 a = 24 b = 30 3 c = 10 1 a = 2 b = 4 c = 1 3 a = 2 b = 4 1 c = 3 a = 24 b = 10 1 c = 30 3 a = 2 b = 3 c = 4 1 a = 2 b = 3 4 c = 1 a = 23 b = 40 4 c = 10 1 a = 2 b = 3 c = 1 4 a = 2 b = 3 1 c = 4 a = 23 b = 10 1 c = 40 4 a = 2 b = 1 c = 4 3 a = 2 b = 1 4 c = 3 a = 21 b = 40 4 c = 30 3 a = 2 b = 1 c = 3 4 a = 2 b = 1 3 c = 4 a = 21 b = 30 3 c = 40 4 a = 1 b = 4 c = 3 2 a = 1 b = 4 3 c = 2 a = 14 b = 30 3 c = 20 2 a = 1 b = 4 c = 2 3 a = 1 b = 4 2 c = 3 a = 14 b = 20 2 c = 30 3 a = 1 b = 3 c = 4 2 a = 1 b = 3 4 c = 2 a = 13 b = 40 4 c = 20 2 a = 1 b = 3 c = 2 4 a = 1 b = 3 2 c = 4 a = 13 b = 20 2 c = 40 4 a = 1 b = 2 c = 4 3 a = 1 b = 2 4 c = 3 a = 12 b = 40 4 c = 30 3 a = 1 b = 2 c = 3 4 a = 1 b = 2 3 c = 4 a = 12 b = 30 3 c = 40 4

Assertion failed.

3   Fail
x = 5; y_correct = 52; assert(isequal(pandigital_sum(x),y_correct))

a = 5 b = 4 c = 3 2 1 a = 5 b = 4 3 c = 2 1 a = 5 b = 4 3 2 c = 1 a = 54 b = 30 3 c = 21 a = 54 b = 32 c = 10 1 a = 543 b = 200 20 2 c = 100 10 1 a = 5 b = 4 c = 3 1 2 a = 5 b = 4 3 c = 1 2 a = 5 b = 4 3 1 c = 2 a = 54 b = 30 3 c = 12 a = 54 b = 31 c = 20 2 a = 543 b = 100 10 1 c = 200 20 2 a = 5 b = 4 c = 2 3 1 a = 5 b = 4 2 c = 3 1 a = 5 b = 4 2 3 c = 1 a = 54 b = 20 2 c = 31 a = 54 b = 23 c = 10 1 a = 542 b = 300 30 3 c = 100 10 1 a = 5 b = 4 c = 2 1 3 a = 5 b = 4 2 c = 1 3 a = 5 b = 4 2 1 c = 3 a = 54 b = 20 2 c = 13 a = 54 b = 21 c = 30 3 a = 542 b = 100 10 1 c = 300 30 3 a = 5 b = 4 c = 1 3 2 a = 5 b = 4 1 c = 3 2 a = 5 b = 4 1 3 c = 2 a = 54 b = 10 1 c = 32 a = 54 b = 13 c = 20 2 a = 541 b = 300 30 3 c = 200 20 2 a = 5 b = 4 c = 1 2 3 a = 5 b = 4 1 c = 2 3 a = 5 b = 4 1 2 c = 3 a = 54 b = 10 1 c = 23 a = 54 b = 12 c = 30 3 a = 541 b = 200 20 2 c = 300 30 3 a = 5 b = 3 c = 4 2 1 a = 5 b = 3 4 c = 2 1 a = 5 b = 3 4 2 c = 1 a = 53 b = 40 4 c = 21 a = 53 b = 42 c = 10 1 a = 534 b = 200 20 2 c = 100 10 1 a = 5 b = 3 c = 4 1 2 a = 5 b = 3 4 c = 1 2 a = 5 b = 3 4 1 c = 2 a = 53 b = 40 4 c = 12 a = 53 b = 41 c = 20 2 a = 534 b = 100 10 1 c = 200 20 2 a = 5 b = 3 c = 2 4 1 a = 5 b = 3 2 c = 4 1 a = 5 b = 3 2 4 c = 1 a = 53 b = 20 2 c = 41 a = 53 b = 24 c = 10 1 a = 532 b = 400 40 4 c = 100 10 1 a = 5 b = 3 c = 2 1 4 a = 5 b = 3 2 c = 1 4 a = 5 b = 3 2 1 c = 4 a = 53 b = 20 2 c = 14 a = 53 b = 21 c = 40 4 a = 532 b = 100 10 1 c = 400 40 4 a = 5 b = 3 c = 1 4 2 a = 5 b = 3 1 c = 4 2 a = 5 b = 3 1 4 c = 2 a = 53 b = 10 1 c = 42 a = 53 b = 14 c = 20 2 a = 531 b = 400 40 4 c = 200 20 2 a = 5 b = 3 c = 1 2 4 a = 5 b = 3 1 c = 2 4 a = 5 b = 3 1 2 c = 4 a = 53 b = 10 1 c = 24 a = 53 b = 12 c = 40 4 a = 531 b = 200 20 2 c = 400 40 4 a = 5 b = 2 c = 4 3 1 a = 5 b = 2 4 c = 3 1 a = 5 b = 2 4 3 c = 1 a = 52 b = 40 4 c = 31 a = 52 b = 43 c = 10 1 a = 524 b = 300 30 3 c = 100 10 1 a = 5 b = 2 c = 4 1 3 a = 5 b = 2 4 c = 1 3 a = 5 b = 2 4 1 c = 3 a = 52 b = 40 4 c = 13 a = 52 b = 41 c = 30 3 a = 524 b = 100 10 1 c = 300 30 3 a = 5 b = 2 c = 3 4 1 a = 5 b = 2 3 c = 4 1 a = 5 b = 2 3 4 c = 1 a = 52 b = 30 3 c = 41 a = 52 b = 34 c = 10 1 a = 523 b = 400 40 4 c = 100 10 1 a = 5 b = 2 c = 3 1 4 a = 5 b = 2 3 c = 1 4 a = 5 b = 2 3 1 c = 4 a = 52 b = 30 3 c = 14 a = 52 b = 31 c = 40 4 a = 523 b = 100 10 1 c = 400 40 4 a = 5 b = 2 c = 1 4 3 a = 5 b = 2 1 c = 4 3 a = 5 b = 2 1 4 c = 3 a = 52 b = 10 1 c = 43 a = 52 b = 14 c = 30 3 a = 521 b = 400 40 4 c = 300 30 3 a = 5 b = 2 c = 1 3 4 a = 5 b = 2 1 c = 3 4 a = 5 b = 2 1 3 c = 4 a = 52 b = 10 1 c = 34 a = 52 b = 13 c = 40 4 a = 521 b = 300 30 3 c = 400 40 4 a = 5 b = 1 c = 4 3 2 a = 5 b = 1 4 c = 3 2 a = 5 b = 1 4 3 c = 2 a = 51 b = 40 4 c = 32 a = 51 b = 43 c = 20 2 a = 514 b = 300 30 3 c = 200 20 2 a = 5 b = 1 c = 4 2 3 a = 5 b = 1 4 c = 2 3 a = 5 b = 1 4 2 c = 3 a = 51 b = 40 4 c = 23 a = 51 b = 42 c = 30 3 a = 514 b = 200 20 2 c = 300 30 3 a = 5 b = 1 c = 3 4 2 a = 5 b = 1 3 c = 4 2 a = 5 b = 1 3 4 c = 2 a = 51 b = 30 3 c = 42 a = 51 b = 34 c = 20 2 a = 513 b = 400 40 4 c = 200 20 2 a = 5 b = 1 c = 3 2 4 a = 5 b = 1 3 c = 2 4 a = 5 b = 1 3 2 c = 4 a = 51 b = 30 3 c = 24 a = 51 b = 32 c = 40 4 a = 513 b = 200 20 2 c = 400 40 4 a = 5 b = 1 c = 2 4 3 a = 5 b = 1 2 c = 4 3 a = 5 b = 1 2 4 c = 3 a = 51 b = 20 2 c = 43 a = 51 b = 24 c = 30 3 a = 512 b = 400 40 4 c = 300 30 3 a = 5 b = 1 c = 2 3 4 a = 5 b = 1 2 c = 3 4 a = 5 b = 1 2 3 c = 4 a = 51 b = 20 2 c = 34 a = 51 b = 23 c = 40 4 a = 512 b = 300 30 3 c = 400 40 4 a = 4 b = 5 c = 3 2 1 a = 4 b = 5 3 c = 2 1 a = 4 b = 5 3 2 c = 1 a = 45 b = 30 3 c = 21 a = 45 b = 32 c = 10 1 a = 453 b = 200 20 2 c = 100 10 1 a = 4 b = 5 c = 3 1 2 a = 4 b = 5 3 c = 1 2 a = 4 b = 5 3 1 c = 2 a = 45 b = 30 3 c = 12 a = 45 b = 31 c = 20 2 a = 453 b = 100 10 1 c = 200 20 2 a = 4 b = 5 c = 2 3 1 a = 4 b = 5 2 c = 3 1 a = 4 b = 5 2 3 c = 1 a = 45 b = 20 2 c = 31 a = 45 b = 23 c = 10 1 a = 452 b = 300 30 3 c = 100 10 1 a = 4 b = 5 c = 2 1 3 a = 4 b = 5 2 c = 1 3 a = 4 b = 5 2 1 c = 3 a = 45 b = 20 2 c = 13 a = 45 b = 21 c = 30 3 a = 452 b = 100 10 1 c = 300 30 3 a = 4 b = 5 c = 1 3 2 a = 4 b = 5 1 c = 3 2 a = 4 b = 5 1 3 c = 2 a = 45 b = 10 1 c = 32 a = 45 b = 13 c = 20 2 a = 451 b = 300 30 3 c = 200 20 2 a = 4 b = 5 c = 1 2 3 a = 4 b = 5 1 c = 2 3 a = 4 b = 5 1 2 c = 3 a = 45 b = 10 1 c = 23 a = 45 b = 12 c = 30 3 a = 451 b = 200 20 2 c = 300 30 3 a = 4 b = 3 c = 5 2 1 a = 4 b = 3 5 c = 2 ...

Assertion failed.

4   Fail
x = 6; y_correct = 162; assert(isequal(pandigital_sum(x),y_correct))

a = 6 b = 5 c = 4 3 2 1 a = 6 b = 5 4 c = 3 2 1

Matrix dimensions must agree. Error in pandigital_sum (line 10) if a*b==c Error in Test4 (line 3) assert(isequal(pandigital_sum(x),y_correct))

5   Fail
x = 7; y_correct = []; % Strange no ? assert(isequal(pandigital_sum(x),y_correct))

a = 7 b = 6 c = 5 4 3 2 1 a = 7 b = 6 5 c = 4 3 2 1

Matrix dimensions must agree. Error in pandigital_sum (line 10) if a*b==c Error in Test5 (line 3) assert(isequal(pandigital_sum(x),y_correct))

6   Fail
x = 8; y_correct = 13458; assert(isequal(pandigital_sum(x),y_correct))

a = 8 b = 7 c = 6 5 4 3 2 1 a = 8 b = 7 6 c = 5 4 3 2 1

Matrix dimensions must agree. Error in pandigital_sum (line 10) if a*b==c Error in Test6 (line 3) assert(isequal(pandigital_sum(x),y_correct))