Cody

Problem 2674. Generalised Hamming Number

Solution 3210221

Submitted on 14 Oct 2020
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   Fail
X = 5; n=5; y_correct = 5; assert(isequal(hamming2(X,n),y_correct))

Error in solution: Line: 14 Column: 9 Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use '=='.

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

Error in solution: Line: 14 Column: 9 Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use '=='.

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

Error in solution: Line: 14 Column: 9 Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use '=='.

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

Error in solution: Line: 14 Column: 9 Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use '=='.

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

Error in solution: Line: 14 Column: 9 Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use '=='.

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

Error in solution: Line: 14 Column: 9 Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use '=='.

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

Error in solution: Line: 14 Column: 9 Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use '=='.

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

Error in solution: Line: 14 Column: 9 Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use '=='.

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

Error in solution: Line: 14 Column: 9 Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use '=='.

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

Error in solution: Line: 14 Column: 9 Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use '=='.

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

Error in solution: Line: 14 Column: 9 Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use '=='.

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

Error in solution: Line: 14 Column: 9 Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use '=='.

Community Treasure Hunt

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

Start Hunting!