Cody

Problem 44341. Hexagonal numbers on a spiral matrix

Solution 1359320

Submitted on 27 Nov 2017
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))

Error in solution Line: 22 Column: 1 This statement is not inside any function. (It follows the END that terminates the definition of the function "hexagonalSpiral".)

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

Error in solution Line: 22 Column: 1 This statement is not inside any function. (It follows the END that terminates the definition of the function "hexagonalSpiral".)

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

Error in solution Line: 22 Column: 1 This statement is not inside any function. (It follows the END that terminates the definition of the function "hexagonalSpiral".)

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

Error in solution Line: 22 Column: 1 This statement is not inside any function. (It follows the END that terminates the definition of the function "hexagonalSpiral".)

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

Error in solution Line: 22 Column: 1 This statement is not inside any function. (It follows the END that terminates the definition of the function "hexagonalSpiral".)

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

Error in solution Line: 22 Column: 1 This statement is not inside any function. (It follows the END that terminates the definition of the function "hexagonalSpiral".)

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

Error in solution Line: 22 Column: 1 This statement is not inside any function. (It follows the END that terminates the definition of the function "hexagonalSpiral".)

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

Error in solution Line: 22 Column: 1 This statement is not inside any function. (It follows the END that terminates the definition of the function "hexagonalSpiral".)

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

Error in solution Line: 22 Column: 1 This statement is not inside any function. (It follows the END that terminates the definition of the function "hexagonalSpiral".)

Suggested Problems

More from this Author62

Community Treasure Hunt

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

Start Hunting!