Cody

# Problem 2595. Polite numbers. Politeness.

Solution 812212

Submitted on 22 Jan 2016 by David Schafer
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))

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

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

f = 3 P = 1

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

f = 7 P = 1

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

f = 3 3 count = 2 P = 2

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

f = 3 5 k = 2 count = 1 1 P = 3

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

f = 3 3 count = 2 P = 2

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

f = 3 7 k = 2 count = 1 1 P = 3

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

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

f = 5 5 41 count = 2 k = 2 count = 2 1 P = 5

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

f = 3 5 41 41 k = 2 count = 1 1 k = 3 count = 1 1 1 count = 1 1 2 P = 11

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

f = 31 P = 1

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

f = 3 3 7 count = 2 k = 2 count = 2 1 P = 5

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

f = 5 13 k = 2 count = 1 1 P = 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))

f = 13 17 37 k = 2 count = 1 1 k = 3 count = 1 1 1 P = 7

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

f = 5 1009 3229 k = 2 count = 1 1 k = 3 count = 1 1 1 P = 7 f = 5 3229 k = 2 count = 1 1 P = 3 f = 1009 P = 1 f = 11 1597 8783 k = 2 count = 1 1 k = 3 count = 1 1 1 P = 7 f = 11 1597 k = 2 count = 1 1 P = 3 f = 8783 P = 1 f = 3 5 97 2909 k = 2 count = 1 1 k = 3 count = 1 1 1 k = 4 count = 1 1 1 1 P = 15 f = 3 5 97 k = 2 count = 1 1 k = 3 count = 1 1 1 P = 7 f = 2909 P = 1 f = 3 3 3 3 7 283 count = 2 count = 3 count = 4 k = 2 count = 4 1 k = 3 count = 4 1 1 P = 19 f = 3 3 3 3 7 count = 2 count = 3 count = 4 k = 2 count = 4 1 P = 9 f = 283 P = 1 f = 7 17 139 229 k = 2 count = 1 1 k = 3 count = 1 1 1 k = 4 count = 1 1 1 1 P = 15 f = 17 229 k = 2 count = 1 1 P = 3 f = 7 139 k = 2 count = 1 1 P = 3 f = 71 139 2467 k = 2 count = 1 1 k = 3 count = 1 1 1 P = 7 f = 71 139 k = 2 count = 1 1 P = 3 f = 2467 P = 1 f = 3 17 23 43 349 k = 2 count = 1 1 k = 3 count = 1 1 1 k = 4 count = 1 1 1 1 k = 5 count = 1 1 1 1 1 P = 31 f = 3 23 43 k = 2 count = 1 1 k = 3 count = 1 1 1 P = 7 f = 17 349 k = 2 count = 1 1 P = 3 f = 3 7 7 7 23 179 k = 2 count = 1 1 count = 1 2 count = 1 3 k = 3 count = 1 3 1 k = 4 count = 1 3 1 1 P = 31 f = 23 179 k = 2 count = 1 1 P = 3 f = 3 7 7 7 k = 2 count = 1 1 count = 1 2 count = 1 3 P = 7 f = 3 5 367 881 k = 2 count = 1 1 k = 3 count = 1 1 1 k = 4 count = 1 1 1 1 P = 15 f = 5 881 k = 2 count = 1 1 P = 3 f = 3 367 k = 2 count = 1 1 P = 3 f = 3 2017 2689 k = 2 count = 1 1 k = 3 count = 1 1 1 P = 7 f = 2017 P = 1 f = 3 2689 k = 2 count = 1 1 P = 3 f = 3 5 11 229 1249 k = 2 count = 1 1 k = 3 count = 1 1 1 k = 4 count = 1 1 1 1 k = 5 count = 1 1 1 1 1 P = 31 f = 3 5 229 k = 2 count = 1 1 k = 3 count = 1 1 1 P = 7 f = 11 1249 k = 2 count = 1 1 P = 3 f = 7687 15373 k = 2 count = 1 1 P = 3 f = 7687 P = 1 f = 15373 P = 1 f = 3 3 3 3 97 3929 count = 2 count = 3 count = 4 k = 2 count = 4 1 k = 3 count = 4 1 1 P = 19 f = 3929 P = 1 f = 3 3 3 3 97 count = 2 count = 3 count = 4 k = 2 count = 4 1 P = 9 f = 3 7 7 11 41 137 k = 2 count = 1 1 count = 1 2 k = 3 count = 1 2 1 k = 4 count = 1 2 1 1 k = 5 count = 1 2 1 1 1 P = 47 f = 11 137 k = 2 count = 1 1 P = 3 f = 3 7 7 41 k = 2 count = 1 1 count = 1 2 k = 3 count = 1 2 1 P = 11 f = 3 5 7 17 571 k = 2 count = 1 1 k = 3 count = 1 1 1 k = 4 count = 1 1 1 1 k = 5 count = 1 1 1 1 1 P = 31 f = 3 7 17 k = 2 count = 1 1 k = 3 count = 1 1 1 P = 7 f = 5 571 k = 2 count = 1 1 P = 3 f = 7 13 127 547 k = 2 count = 1 1 k = 3 count = 1 1 1 k = 4 count = 1 1 1 1 P = 15 f = 7 127 k = 2 count = 1 1 P = 3 f = 13 547 k = 2 count = 1 1 P = 3 f = 7 13 17 12377 k = 2 count = 1 1 k = 3 count = 1 1 1 k = 4 count = 1 1 1 1 P = 15 f = 12377 P = 1 f = 7 13 17 k = 2 count = 1 1 k = 3 count = 1 1 1 P = 7 f = 3 3 5 19 19 23 113 count = 2 k = 2 count = 2 1 k = 3 count = 2 1 1 count = 2 1 2 k = 4 count = 2 1 2 1 k = 5 count = 2 1 2 1 1 P = 71 f = 3 3 19 19 count = 2 k = 2 count = 2 1 count = 2 2 P = 8 f = 5 23 113 k = 2 count = 1 1 k = 3 count = 1 1 1 P = 7 f = 3 3 3 3 29 41 229 count = 2 count = 3 count = 4 k = 2 count = 4 1 k = 3 count = 4 1 1 k = 4 count = 4 1 1 1 P = 39 f = 3 3 3 3 41 count = 2 count = 3 count = 4 k = 2 count = 4 1 P = 9 f = 29 229 k = 2 count = 1 1 P = 3 f = 3 5 5 11 23 67 113 k = 2 count = 1 1 count = 1 2 k = 3 count = 1 2 1 k = 4 count = 1 2 1 1 k = 5 count = 1 2 1 1 1 k = 6 count = 1 2 1 1 1 1 P = 95 f = 11 23 67 k = 2 count = 1 1 k = 3 count = 1 1 1 P = 7 f = 3 5 5 113 k = 2 count = 1 1 count = 1 2 k = 3 count = 1 2 1 P = 11