Cody

# Problem 240. Project Euler: Problem 6, Natural numbers, squares and sums.

Solution 1668935

Submitted on 8 Nov 2018 by hossein Yadi
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 = 10; y_correct = 2640; assert(isequal(euler006(x),y_correct))

m = 1 m = 1 2 m = 1 2 3 m = 1 2 3 4 m = 1 2 3 4 5 m = 1 2 3 4 5 6 m = 1 2 3 4 5 6 7 m = 1 2 3 4 5 6 7 8 m = 1 2 3 4 5 6 7 8 9 m = 1 2 3 4 5 6 7 8 9 10 n = 1 4 9 16 25 36 49 64 81 100 e = 385 p = 3025 y = 2640

2   Pass
x = 20; y_correct = 41230; assert(isequal(euler006(x),y_correct))

m = 1 m = 1 2 m = 1 2 3 m = 1 2 3 4 m = 1 2 3 4 5 m = 1 2 3 4 5 6 m = 1 2 3 4 5 6 7 m = 1 2 3 4 5 6 7 8 m = 1 2 3 4 5 6 7 8 9 m = 1 2 3 4 5 6 7 8 9 10 m = 1 2 3 4 5 6 7 8 9 10 11 m = 1 2 3 4 5 6 7 8 9 10 11 12 m = 1 2 3 4 5 6 7 8 9 10 11 12 13 m = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 m = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 m = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 m = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 m = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 m = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 m = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 n = 1 4 9 16 25 36 49 64 81 100 121 144 169 196 225 256 289 324 361 400 e = 2870 p = 44100 y = 41230

3   Pass
x = 200; y_correct = 401323300; assert(isequal(euler006(x),y_correct))

m = 1 m = 1 2 m = 1 2 3 m = 1 2 3 4 m = 1 2 3 4 5 m = 1 2 3 4 5 6 m = 1 2 3 4 5 6 7 m = 1 2 3 4 5 6 7 8 m = 1 2 3 4 5 6 7 8 9 m = 1 2 3 4 5 6 7 8 9 10 m = 1 2 3 4 5 6 7 8 9 10 11 m = 1 2 3 4 5 6 7 8 9 10 11 12 m = 1 2 3 4 5 6 7 8 9 10 11 12 13 m = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 m = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 m = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 m = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 m = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 m = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 m = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 m = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 m = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 m = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 m = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 m = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 m = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 m = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 m = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 m = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 m = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 m = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Column 31 31 m = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 32 31 32 m = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 33 31 32 33 m = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 34 31 32 33 34 m = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 35 31 32 33 34 35 m = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 36 31 32 33 34 35 36 m = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 37 31 32 33 34 35 36 37 m = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 38 31 32 33 34 35 36 37 38 m = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 39 31 32 33 34 35 36 37 38 39 m = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 40 31 32 33 34 35 36 37 38 39 40 m = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 41 31 32 33 34 35 36 37 38 39 40 41 m = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 42 31 32 33 34 35 36 37 38 39 40 41 42 m = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 43 31 32 33 34 35 36 37 38 39 40 41 42 43 m = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 44 31 32 33 34 35 36 37 38 39 40 41 42 43 44 m = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 45 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 m = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 46 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 m = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 47 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 m = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 48 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 m = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 49 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 m = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 50 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 m = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 51 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 m = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 52 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 m = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 ...