Cody

# Problem 2674. Generalised Hamming Number

Solution 1897171

Submitted on 11 Aug 2019 by Nikolaos Nikolaou
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))

ans = 3 y = 5

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

ans = 3 y = 9

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

ans = 3 y = 34

4   Pass
X = 100; n=7; y_correct = 46; assert(isequal(hamming2(X,n),y_correct))

ans = 4 y = 46

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

p1 = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 60 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 Columns 61 through 90 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 Columns 91 through 100 91 92 93 94 95 96 97 98 99 100 ans = 25 y = 100

6   Pass
X = 100; n=13; y_correct = 62; assert(isequal(hamming2(X,n),y_correct))

ans = 6 y = 62

7   Pass
X = 10^13; n=7; y_correct = 19674; assert(isequal(hamming2(X,n),y_correct))

ans = 4 y = 19674

8   Pass
X = 10^5; n=13; y_correct = 1848; assert(isequal(hamming2(X,n),y_correct))

ans = 6 y = 1848

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

ans = 3 y = 313

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

ans = 3 y = 327

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

ans = 2 y = 624

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

ans = 1 y = 17