Cody

Solution 1223440

Submitted on 1 Jul 2017 by Augusto Mazzei
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 = 5; n=5; y_correct = 5; assert(isequal(hamming2(X,n),y_correct))

y = 5

2   Pass
X = 10; n=5; y_correct = 9; assert(isequal(hamming2(X,n),y_correct))

Hammers = 2 3 5 Nails = 4 3 2 M = 0 0 0 1 0 0 2 0 0 3 0 0 0 1 0 1 1 0 2 1 0 3 1 0 0 2 0 1 2 0 2 2 0 3 2 0 0 0 1 1 0 1 2 0 1 3 0 1 0 1 1 1 1 1 2 1 1 3 1 1 0 2 1 1 2 1 2 2 1 3 2 1 y = 9

3   Pass
X = 100; n=5; y_correct = 34; assert(isequal(hamming2(X,n),y_correct))

Hammers = 2 3 5 Nails = 7 5 3 M = 0 0 0 1 0 0 2 0 0 3 0 0 4 0 0 5 0 0 6 0 0 0 1 0 1 1 0 2 1 0 3 1 0 4 1 0 5 1 0 6 1 0 0 2 0 1 2 0 2 2 0 3 2 0 4 2 0 5 2 0 6 2 0 0 3 0 1 3 0 2 3 0 3 3 0 4 3 0 5 3 0 6 3 0 0 4 0 1 4 0 2 4 0 3 4 0 4 4 0 5 4 0 6 4 0 0 0 1 1 0 1 2 0 1 3 0 1 4 0 1 5 0 1 6 0 1 0 1 1 1 1 1 2 1 1 3 1 1 4 1 1 5 1 1 6 1 1 0 2 1 1 2 1 2 2 1 3 2 1 4 2 1 5 2 1 6 2 1 0 3 1 1 3 1 2 3 1 3 3 1 4 3 1 5 3 1 6 3 1 0 4 1 1 4 1 2 4 1 3 4 1 4 4 1 5 4 1 6 4 1 0 0 2 1 0 2 2 0 2 3 0 2 4 0 2 5 0 2 6 0 2 0 1 2 1 1 2 2 1 2 3 1 2 4 1 2 5 1 2 6 1 2 0 2 2 1 2 2 2 2 2 3 2 2 4 2 2 5 2 2 6 2 2 0 3 2 1 3 2 2 3 2 3 3 2 4 3 2 5 3 2 6 3 2 0 4 2 1 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9 3 1 0 0 0 10 3 1 0 0 0 11 3 1 0 0 0 12 3 1 0 0 0 13 3 1 0 0 0 14 3 1 0 0 0 15 3 1 0 0 0 16 3 1 0 0 0 0 4 1 0 0 0 1 4 1 0 0 0 2 4 1 0 0 0 3 4 1 0 0 0 4 4 1 0 0 0 5 4 1 0 0 0 6 4 1 0 0 0 7 4 1 0 0 0 8 4 1 0 0 0 9 4 1 0 0 0 10 4 1 0 0 0 11 4 1 0 0 0 12 4 1...

9   Pass
X = 10^5; n=5; y_correct = 313; assert(isequal(hamming2(X,n),y_correct))

Hammers = 2 3 5 Nails = 17 11 8 M = 0 0 0 1 0 0 2 0 0 3 0 0 4 0 0 5 0 0 6 0 0 7 0 0 8 0 0 9 0 0 10 0 0 11 0 0 12 0 0 13 0 0 14 0 0 15 0 0 16 0 0 0 1 0 1 1 0 2 1 0 3 1 0 4 1 0 5 1 0 6 1 0 7 1 0 8 1 0 9 1 0 10 1 0 11 1 0 12 1 0 13 1 0 14 1 0 15 1 0 16 1 0 0 2 0 1 2 0 2 2 0 3 2 0 4 2 0 5 2 0 6 2 0 7 2 0 8 2 0 9 2 0 10 2 0 11 2 0 12 2 0 13 2 0 14 2 0 15 2 0 16 2 0 0 3 0 1 3 0 2 3 0 3 3 0 4 3 0 5 3 0 6 3 0 7 3 0 8 3 0 9 3 0 10 3 0 11 3 0 12 3 0 13 3 0 14 3 0 15 3 0 16 3 0 0 4 0 1 4 0 2 4 0 3 4 0 4 4 0 5 4 0 6 4 0 7 4 0 8 4 0 9 4 0 10 4 0 11 4 0 12 4 0 13 4 0 14 4 0 15 4 0 16 4 0 0 5 0 1 5 0 2 5 0 3 5 0 4 5 0 5 5 0 6 5 0 7 5 0 8 5 0 9 5 0 10 5 0 11 5 0 12 5 0 13 5 0 14 5 0 15 5 0 16 5 0 0 6 0 1 6 0 2 6 0 3 6 0 4 6 0 5 6 0 6 6 0 7 6 0 8 6 0 9 6 0 10 6 0 11 6 0 12 6 0 13 6 0 14 6 0 15 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2 0 5 2 1 5 2 2 5 2 3 5 2 4 5 2 5 5 2 6 5 2 7 5 2 8 5 2 9 5 2 10 5 2 11 5 2 12 5 2 13 5 2 14 5 2 15 5 2 16 5 2 0 6 2 1 6 2 2 6 2 3 6 2 4 6 2 5 6 2 6 6 2 7 6 2 8 6 2 9 6 2 10 6 2 11 6 2 12 6 2 13 6 2 14 6 2 15 6 2 16 6 2 0 7 2 1 7 2 2 7 2 3 7 2 4 7 2 5 7 2 6 7 2 7 7 2 8 7 2 9 7 2 10 7 2 11 7 2 12 7 2 13 7 2 14 7 2 15 7 2 16 7 2 0 8 2 1 8 2 2 8 2 3 8 2 4 8 2 5 8 2 6 8 2 7 8 2 8 8 2 9 8 2 10 8 2 11 8 2 12 8 ...

10   Pass
X = 123456; n=5; y_correct = 327; assert(isequal(hamming2(X,n),y_correct))

Hammers = 2 3 5 Nails = 17 11 8 M = 0 0 0 1 0 0 2 0 0 3 0 0 4 0 0 5 0 0 6 0 0 7 0 0 8 0 0 9 0 0 10 0 0 11 0 0 12 0 0 13 0 0 14 0 0 15 0 0 16 0 0 0 1 0 1 1 0 2 1 0 3 1 0 4 1 0 5 1 0 6 1 0 7 1 0 8 1 0 9 1 0 10 1 0 11 1 0 12 1 0 13 1 0 14 1 0 15 1 0 16 1 0 0 2 0 1 2 0 2 2 0 3 2 0 4 2 0 5 2 0 6 2 0 7 2 0 8 2 0 9 2 0 10 2 0 11 2 0 12 2 0 13 2 0 14 2 0 15 2 0 16 2 0 0 3 0 1 3 0 2 3 0 3 3 0 4 3 0 5 3 0 6 3 0 7 3 0 8 3 0 9 3 0 10 3 0 11 3 0 12 3 0 13 3 0 14 3 0 15 3 0 16 3 0 0 4 0 1 4 0 2 4 0 3 4 0 4 4 0 5 4 0 6 4 0 7 4 0 8 4 0 9 4 0 10 4 0 11 4 0 12 4 0 13 4 0 14 4 0 15 4 0 16 4 0 0 5 0 1 5 0 2 5 0 3 5 0 4 5 0 5 5 0 6 5 0 7 5 0 8 5 0 9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 2 11 3 2 12 3 2 13 3 2 14 3 2 15 3 2 16 3 2 0 4 2 1 4 2 2 4 2 3 4 2 4 4 2 5 4 2 6 4 2 7 4 2 8 4 2 9 4 2 10 4 2 11 4 2 12 4 2 13 4 2 14 4 2 15 4 2 16 4 2 0 5 2 1 5 2 2 5 2 3 5 2 4 5 2 5 5 2 6 5 2 7 5 2 8 5 2 9 5 2 10 5 2 11 5 2 12 5 2 13 5 2 14 5 2 15 5 2 16 5 2 0 6 2 1 6 2 2 6 2 3 6 2 4 6 2 5 6 2 6 6 2 7 6 2 8 6 2 9 6 2 10 6 2 11 6 2 12 6 2 13 6 2 14 6 2 15 6 2 16 6 2 0 7 2 1 7 2 2 7 2 3 7 2 4 7 2 5 7 2 6 7 2 7 7 2 8 7 2 9 7 2 10 7 2 11 7 2 12 7 2 13 7 2 14 7 2 15 7 2 16 7 2 0 8 2 1 8 2 2 8 2 3 8 2 4 8 2 5 8 2 6 8 2 7 8 2 8 8 2 9 8 2 10 8 2 11 8 2 12 8 ...

11   Pass
X = 10^13; n=3; y_correct = 624; assert(isequal(hamming2(X,n),y_correct))

Hammers = 2 3 Nails = 44 28 M = 0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15 0 16 0 17 0 18 0 19 0 20 0 21 0 22 0 23 0 24 0 25 0 26 0 27 0 28 0 29 0 30 0 31 0 32 0 33 0 34 0 35 0 36 0 37 0 38 0 39 0 40 0 41 0 42 0 43 0 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 0 2 1 2 2 2 3 2 4 2 5 2 6 2 7 2 8 2 9 2 10 2 11 2 12 2 13 2 14 2 15 2 16 2 17 2 18 2 19 2 20 2 21 2 22 2 23 2 24 2 25 2 26 2 27 2 28 2 29 2 30 2 31 2 32 2 33 2 34 2 35 2 36 2 37 2 38 2 39 2 40 2 41 2 42 2 43 2 0 3 1 3 2 3 3 3 4 3 5 3 6 3 7 3 8 3 9 3 10 3 11 3 12 3 13 3 14 3 15 3 16 3 17 3 18 3 19 3 20 3 21 3 22 3 23 3 24 3 25 3 26 3 27 3 28 3 29 3 30 3 31 3 32 3 33 3 34 3 35 3 36 3 37 3 38 3 39 3 40 3 41 3 42 3 43 3 0 4 1 4 2 4 3 4 4 4 5 4 6 4 7 4 8 4 9 4 10 4 11 4 12 4 13 4 14 4 15 4 16 4 17 4 18 4 19 4 20 4 21 4 22 4 23 4 24 4 25 4 26 4 27 4 28 4 29 4 30 4 31 4 32 4 33 4 34 4 35 4 36 4 37 4 38 4 39 4 40 4 41 4 42 4 43 4 0 5 1 5 2 5 3 5 4 5 5 5 6 5 7 5 8 5 9 5 10 5 11 5 12 5 13 5 14 5 15 5 16 5 17 5 18 5 19 5 20 5 21 5 22 5 23 5 24 5 25 5 26 5 27 5 28 5 29 5 30 5 31 5 32 5 33 5 34 5 35 5 36 5 37 5 38 5 39 5 40 5 41 5 42 5 43 5 0 6 1 6 2 6 3 6 4 6 5 6 6 6 7 6 8 6 9 6 10 6 11 6 12 6 13 6 14 6 15 6 16 6 17 6 18 6 19 6 20 6 21 6 22 6 23 6 24 6 25 6 26 6 27 6 28 6 29 6 30 6 31 6 32 6 33 6 34 6 35 6 36 6 37 6 38 6 39 6 40 6 41 6 42 6 43 6 0 7 1 7 2 7 3 7 4 7 5 7 6 7 7 7 8 7 9 7 10 7 11 7 12 7 13 7 14 7 15 7 16 7 17 7 18 7 19 7 20 7 21 7 22 7 23 7 24 7 25 7 26 7 27 7 28 7 29 7 30 7 31 7 32 7 33 7 34 7 35 7 36 7 37 7 38 7 39 7 40 7 41 7 42 7 43 7 0 8 1 8 2 8 3 8 4 8 5 8 6 8 7 8 8 8 9 8 10 8 11 8 12 8 13 8 14 8 15 8 16 8 17 8 18 8 19 8 20 8 21 8 22 8 23 8 24 8 25 8 26 8 27 8 28 8 29 8 30 8 31 8 32 8 33 8 34 8 35 8 36 8 37 8 38 8 39 8 40 8 41 8 42 8 43 8 0 9 1 9 2 9 3 9 4 9 5 9 6 9 7 9 8 9 9 9 10 9 11 9 12 9 13 9 14 9 15 9 16 9 17 9 18 9 19 9 20 9 21 9 22 9 23 9 24 9 25 9 26 9 27 9 28 9 29 9 30 9 31 9 32 9 33 9 34 9 35 9 36 9 37 9 38 9 39 9 40 9 41 9 42 9 43 9 0 10 1 10 2 10 3 10 4 10 5 10 6 10 7 10 8 10 9 10 10 10 11 10 12 10 13 10 14 10 15 10 16 10 17 10 18 10 19 10 20 10 21 10 22 10 23 10 24 10 25 10 26 10 27 10 28 10 29 10 30 10 31 10 32 10 33 10 34 10 35 10 36 10 37 10 38 10 39 10 40 10 41 10 42 10 43 10 0 11 1 11 2 11 3 11 4 11 5 11 6 11 7 11 8 11 9 11 10 11 11 11 12 11 13 11 14 11 15 11 16 11 17 11 18 11 19 11 20 11 21 11 22 11 23 11 24 11 25 11 26 11 27 11 28 11 29 11 30 11 31 11 32 11 33 11 34 11 35 11 36 11 37 11 38 11 39 11 40 11 41 11 42 11 43 11 0 12 1 12 2 12 3 12 4 12 5 12 6 12 7 12 8 12 9 12 10 12 11 12 12 12 13 12 14 12 15 12 16 12 17 12 18 12 19 12 20 12 21 12 22 12 23 12 24 12 25 12 26 12 27 12 28 12 29 12 30 12 31 12 32 12 33 12 34 12 35 12 36 12 37 12 38 12 39 12 40 12 41 12 42 12 43 12 0 13 1 13 2 13 3 13 4 13 5 13 6 13 7 13 8 13 9 13 10 13 11 13 12 13 13 13 14 13 15 13 16 13 17 13 18 13 19 13 20 13 21 13 22 13 23 13 24 13 25 13 26 13 27 13 28 13 29 13 30 13 31 13 32 13 33 13 34 13 35 13 36 13 37 13 38 13 39 13 40 13 41 13 42 13 43 13 0 14 1 14 2 14 3 14 4 14 5 14 6 14 7 14 8 14 9 14 10 14 11 14 12 14 13 14 14 14 15 14 16 14 17 14 18 14 19 14 20 14 21 14 22 14 23 14 24 14 25 14 26 14 27 14 28 14 29 14 30 14 31 14 32 14 33 14 34 14 35 14 36 14 37 14 38 14 39 14 40 14 41 14 42 14 43 14 0 15 1 15 2 15 3 15 4 15 5 15 6 15 7 15 8 15 9 15 10 15 11 15 12 15 13 15 14 15 15 15 16 15 17 15 18 15 19 15 20 15 21 15 22 15 23 15 24 15 25 15 26 15 27 15 28 15 29 15 30 15 31 15 32 15 33 15 34 15 35 15 36 15 37 15 38 15 39 15 40 15 41 15 42 15 43 15 0 16 1 16 2 16 3 16 4 16 5 16 6 16 7 16 8 16 9 16 10 16 11 16 12 16 13 16 14 16 15 16 16 16 17 16 18 16 19 16 20 16 21 16 22 16 23 16 24 16 25 16 26 16 27 16 28 16 29 16 30 16 31 16 32 16 33 16 34 16 35 16 36 16 37 16 38 16 39 16 40 16 41 16 42 16 43 16 0 17 1 17 2 17 3 17 4 17 5 17 6 17 7 17 8 17 9 17 10 17 11 17 12 17 13 17 14 17 15 17 16 17 ...

12   Pass
X = 123456; n=2; y_correct = 17; assert(isequal(hamming2(X,n),y_correct))

Hammers = 2 Nails = 17 M = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 y = 17