Cody

# Problem 44341. Hexagonal numbers on a spiral matrix

Solution 1954522

Submitted on 1 Oct 2019
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
m = 1; y_correct = '1'; assert(isequal(hexagonalSpiral(m),y_correct))

ans = '1'

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

2   Fail
m = 2; y_correct = '16'; assert(isequal(hexagonalSpiral(m),y_correct))

ans = '16'

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

3   Fail
m = 5; y_correct = '1293'; assert(isequal(hexagonalSpiral(m),y_correct))

ans = '1293'

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

4   Fail
m = 16; y_correct = '420800'; assert(isequal(hexagonalSpiral(m),y_correct))

ans = '420800'

Output argument "y" (and maybe others) not assigned during call to "hexagonalSpiral". Error in Test4 (line 3) assert(isequal(hexagonalSpiral(m),y_correct))

5   Fail
m = 100; y_correct = '4000333360'; assert(isequal(hexagonalSpiral(m),y_correct))

ans = '4000333360'

Output argument "y" (and maybe others) not assigned during call to "hexagonalSpiral". Error in Test5 (line 3) assert(isequal(hexagonalSpiral(m),y_correct))

6   Fail
m = 1295; y_correct = '1456830580539887'; assert(isequal(hexagonalSpiral(m),y_correct))

ans = '1456830580539887'

Output argument "y" (and maybe others) not assigned during call to "hexagonalSpiral". Error in Test6 (line 3) assert(isequal(hexagonalSpiral(m),y_correct))

7   Fail
m = 2500; y_correct = '39062505208334000'; assert(isequal(hexagonalSpiral(m),y_correct))

ans = '3.9062505208334e+16'

Output argument "y" (and maybe others) not assigned during call to "hexagonalSpiral". Error in Test7 (line 3) assert(isequal(hexagonalSpiral(m),y_correct))

8   Fail
m = 5000; y_correct = '1250000041666668000'; assert(isequal(hexagonalSpiral(m),y_correct))

ans = '1.250000041666668e+18'

Output argument "y" (and maybe others) not assigned during call to "hexagonalSpiral". Error in Test8 (line 3) assert(isequal(hexagonalSpiral(m),y_correct))

9   Fail
m = 8000; y_correct = '13107200170666668800'; assert(isequal(hexagonalSpiral(m),y_correct))

ans = '1.310720017066667e+19'

Output argument "y" (and maybe others) not assigned during call to "hexagonalSpiral". Error in Test9 (line 3) assert(isequal(hexagonalSpiral(m),y_correct))