Cody

Problem 2674. Generalised Hamming Number

Solution 1764527

Submitted on 27 Mar 2019 by Abdelfatah Teamah
• Size: 8
• This is the leading solution.
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))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In hamming2 (line 2) In ScoringEngineTestPoint1 (line 4) In solutionTest (line 3)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In hamming2 (line 2) In ScoringEngineTestPoint2 (line 4) In solutionTest (line 5)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In hamming2 (line 2) In ScoringEngineTestPoint3 (line 4) In solutionTest (line 7)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In hamming2 (line 2) In ScoringEngineTestPoint4 (line 4) In solutionTest (line 9)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In hamming2 (line 2) In ScoringEngineTestPoint5 (line 4) In solutionTest (line 11)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In hamming2 (line 2) In ScoringEngineTestPoint6 (line 4) In solutionTest (line 13)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In hamming2 (line 2) In ScoringEngineTestPoint7 (line 4) In solutionTest (line 15)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In hamming2 (line 2) In ScoringEngineTestPoint8 (line 4) In solutionTest (line 17)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In hamming2 (line 2) In ScoringEngineTestPoint9 (line 4) In solutionTest (line 19)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In hamming2 (line 2) In ScoringEngineTestPoint10 (line 4) In solutionTest (line 21)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In hamming2 (line 2) In ScoringEngineTestPoint11 (line 4) In solutionTest (line 23)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In hamming2 (line 2) In ScoringEngineTestPoint12 (line 4) In solutionTest (line 25)]