Cody

# Problem 2145. Find the index of n in magic(n)

Solution 463904

Submitted on 29 Jun 2014 by RA
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 = 7; y_correct = [2,3]; assert(isequal(nim(x),y_correct))

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

2   Pass
%% x = 11; y_correct = [2,5]; assert(isequal(nim(x),y_correct))

m = 68 81 94 107 120 1 14 27 40 53 66 80 93 106 119 11 13 26 39 52 65 67 92 105 118 10 12 25 38 51 64 77 79 104 117 9 22 24 37 50 63 76 78 91 116 8 21 23 36 49 62 75 88 90 103 7 20 33 35 48 61 74 87 89 102 115 19 32 34 47 60 73 86 99 101 114 6 31 44 46 59 72 85 98 100 113 5 18 43 45 58 71 84 97 110 112 4 17 30 55 57 70 83 96 109 111 3 16 29 42 56 69 82 95 108 121 2 15 28 41 54 r = 2 c = 5 y = 2 5

3   Pass
%% x = 3; y_correct = [2,1]; assert(isequal(nim(x),y_correct))

m = 8 1 6 3 5 7 4 9 2 r = 2 c = 1 y = 2 1

### Community Treasure Hunt

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

Start Hunting!