Cody

# Problem 1308. Give me Hamming on five, hold the mayo

Solution 210997

Submitted on 1 Mar 2013 by Christopher
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
feval(@assignin,'caller','score',5000); % msec forbidden = '(feval|eval|regexp|inline|tic|assert)'; assert(isempty(regexp(evalc('type hamming1'),forbidden)));

2   Pass
%% tic

3   Pass
%% x = 5; y_correct = 5; assert(isequal(hamming1(x),y_correct))

lx = 1.6094

4   Pass
%% x = 100; y_correct = 34; assert(isequal(hamming1(x),y_correct))

lx = 4.6052

5   Pass
%% x = 123456; y_correct = 327; assert(isequal(hamming1(x),y_correct))

lx = 11.7236

6   Pass
%% x = 10^13; y_correct = 4301; assert(isequal(hamming1(x),y_correct))

lx = 29.9336

7   Pass
%% x=1:20; y=arrayfun(@(z) hamming1(z),2.^x); y_correct=[2 4 7 12 19 27 38 52 68 87 110 137 167 201 240 284 332 386 446 511]; assert(isequal(y,y_correct)); tval=1000*toc feval( @assignin,'caller','score',floor(min(5000,tval )) );

lx = 0.6931 lx = 1.3863 lx = 2.0794 lx = 2.7726 lx = 3.4657 lx = 4.1589 lx = 4.8520 lx = 5.5452 lx = 6.2383 lx = 6.9315 lx = 7.6246 lx = 8.3178 lx = 9.0109 lx = 9.7041 lx = 10.3972 lx = 11.0904 lx = 11.7835 lx = 12.4766 lx = 13.1698 lx = 13.8629 tval = 12.5810