First solution using spdiags. Flexible options available.
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
%%
m=[5 1 8;3 9 4;7 2 6];
K=kurchan_score(m) % 486
assert(K==486)
K =
486
|
2 | Pass |
%%
m=[1 24 65 80 68 41 54 36 39
49 51 28 14 67 57 77 2 45
37 23 40 42 6 10 81 55 69
74 58 3 30 16 43 32 44 70
29 63 79 60 53 35 27 15 4
52 8 31 62 72 73 5 50 25
33 20 22 46 7 71 56 78 18
61 21 38 9 48 13 19 76 66
64 75 59 12 47 11 17 34 26];
tic
K=uint64(kurchan_score(m)) % 481200422400
toc
assert(K==481200422400)
K =
481200422400
Elapsed time is 0.001688 seconds.
|
3 | Pass |
%%
v=[ 1 6 2 9 3 8 4 5 7]; % 366
m=reshape(v,3,[]);
K=uint64(kurchan_score(m))
assert(K==366)
K =
366
|
4 | Pass |
%%
v=[ 8 2 3 7 5 1 9 4 6]; % 486
m=reshape(v,3,[]);
K=uint64(kurchan_score(m))
assert(K==486)
K =
486
|
5 | Pass |
%%
v=[ 9 11 12 7 10 15 5 6 2 14 8 4 3 13 1 16];
m=reshape(v,4,[]); % 29590
K=uint64(kurchan_score(m))
assert(K==29590)
K =
29590
|
6 | Pass |
%%
v=[ 1 16 15 6 12 3 2 8 7 9 14 13 10 11 4 5];
m=reshape(v,4,[]); % 11256
K=uint64(kurchan_score(m))
assert(K==11256)
K =
11256
|
1051 Solvers
Project Euler: Problem 3, Largest prime factor
379 Solvers
Magic is simple (for beginners)
2749 Solvers
483 Solvers
135 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!