Cody

Solution 502325

Submitted on 17 Sep 2014 by Zikobrelli
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 = 1; y_correct = 0; assert(isequal(politeness(x),y_correct))

A = 1 A = [] c = Empty matrix: 0-by-1 ans = 0

2   Pass
%% x = 2; y_correct = 0; assert(isequal(politeness(x),y_correct))

A = 2 A = [] c = Empty matrix: 0-by-1 ans = 0

3   Pass
%% x = 3; y_correct = 1; assert(isequal(politeness(x),y_correct))

A = 3 A = 3 c = 0 1 0 ans = 1

4   Pass
%% x = 7; y_correct = 1; assert(isequal(politeness(x),y_correct))

A = 7 A = 7 c = 0 0 0 1 0 0 0 ans = 1

5   Pass
%% x = 9; y_correct = 2; assert(isequal(politeness(x),y_correct))

A = 3 3 A = 3 3 c = 0 2 0 ans = 2

6   Pass
%% x = 15; y_correct = 3; assert(isequal(politeness(x),y_correct))

A = 3 5 A = 3 5 c = 1 1 ans = 3

7   Pass
%% x = 18; y_correct = 2; assert(isequal(politeness(x),y_correct))

A = 2 3 3 A = 3 3 c = 0 2 0 ans = 2

8   Pass
%% x = 21; y_correct = 3; assert(isequal(politeness(x),y_correct))

A = 3 7 A = 3 7 c = 1 1 ans = 3

9   Pass
%% x = 1024; y_correct = 0; assert(isequal(politeness(x),y_correct))

A = 2 2 2 2 2 2 2 2 2 2 A = Empty matrix: 1-by-0 c = Empty matrix: 1-by-0 ans = 0

10   Pass
%% x = 1025; y_correct = 5; assert(isequal(politeness(x),y_correct))

A = 5 5 41 A = 5 5 41 c = 2 1 ans = 5

11   Pass
%% x = 25215; y_correct = 11; assert(isequal(politeness(x),y_correct))

A = 3 5 41 41 A = 3 5 41 41 c = 1 1 2 ans = 11

12   Pass
%% x = 62; y_correct = 1; assert(isequal(politeness(x),y_correct))

A = 2 31 A = 31 c = Columns 1 through 29 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 30 through 31 0 0 ans = 1

13   Pass
%% x = 63; y_correct = 5; assert(isequal(politeness(x),y_correct))

A = 3 3 7 A = 3 3 7 c = 2 1 ans = 5

14   Pass
%% x = 65; y_correct = 3; assert(isequal(politeness(x),y_correct))

A = 5 13 A = 5 13 c = 1 1 ans = 3

15   Pass
%% % anti-lookup & clue nums=primes(200); pattern=[1 nums([false ~randi([0 25],1,45)])]; x=prod(pattern)*2^randi([0 5]); y_correct=2^numel(pattern)/2-1; assert(isequal(politeness(x),y_correct))

A = 2 2 2 2 11 113 A = 11 113 c = 1 1 ans = 3

16   Pass
%% for k=randi(2e4,1,20) assert(isequal(politeness(k*(k-1))+1,(politeness(k)+1)*(politeness(k-1)+1))) end

A = 2 3 7 11 31 73 A = 3 7 11 31 73 c = 1 1 1 1 1 ans = 31 A = 3 11 31 A = 3 11 31 c = 1 1 1 ans = 7 A = 2 7 73 A = 7 73 c = 1 1 ans = 3 A = 2 2 31 83 643 A = 31 83 643 c = 1 1 1 ans = 7 A = 31 83 A = 31 83 c = 1 1 ans = 3 A = 2 2 643 A = 643 c = Columns 1 through 29 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 30 through 58 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 59 through 87 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 88 through 116 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 117 through 145 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 146 through 174 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 175 through 203 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 204 through 232 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 233 through 261 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 262 through 290 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 291 through 319 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 320 through 348 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 349 through 377 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 378 through 406 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 407 through 435 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 436 through 464 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 465 through 493 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 494 through 522 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 523 through 551 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 552 through 580 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 581 through 609 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 610 through 638 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 639 through 643 0 0 0 0 0 ans = 1 A = 2 2 5 7 19 23 2447 A = 5 7 19 23 2447 c = 1 1 1 1 1 ans = 31 A = 2 2 7 19 23 A = 7 19 23 c = 1 1 1 ans = 7 A = 5 2447 A = 5 2447 c = 1 1 ans = 3 A = 2 251 503 A = 251 503 c = 1 1 ans = 3 A = 503 A = 503 c = Columns 1 through 29 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 30 through 58 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 59 through 87 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 88 through 116 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 117 through 145 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 146 through 174 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 175 through 203 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 204 through 232 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 233 through 261 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 Columns 262 through 290 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 291 through 319 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 320 through 348 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 349 through 377 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 378 through 406 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 407 through 435 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 436 through 464 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 465 through 493 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 494 through 503 0 0 0 0 0 0 0 0 0 0 ans = 1 A = 2 251 A = 251 c = Columns 1 through 29 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 30 through 58 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 59 through 87 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 88 through 116 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 117 through 145 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 146 through 174...

Suggested Problems

More from this Author47