Cody

# Problem 2595. Polite numbers. Politeness.

Solution 1977209

Submitted on 15 Oct 2019 by Piotr Lesniewski
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))

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

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

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

prod = 2

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

prod = 1

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

prod = 2

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))

prod = 3

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

prod = 2 prod = 4

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

prod = 1

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

prod = 3

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

prod = 2

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))

prod = 2 prod = 4 prod = 8

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

prod = 1 prod = 2 prod = 4 prod = 8 prod = 16 prod = 1 prod = 2 prod = 2 prod = 4 prod = 1 prod = 2 prod = 4 prod = 8 prod = 1 prod = 2 prod = 2 prod = 1 prod = 4 prod = 8 prod = 16 prod = 4 prod = 1 prod = 2 prod = 1 prod = 2 prod = 4 prod = 8 prod = 24 prod = 1 prod = 2 prod = 4 prod = 2 prod = 1 prod = 4 prod = 12 prod = 24 prod = 4 prod = 1 prod = 2 prod = 1 prod = 3 prod = 6 prod = 1 prod = 3 prod = 1 prod = 2 prod = 4 prod = 8 prod = 2 prod = 4 prod = 1 prod = 1 prod = 2 prod = 4 prod = 8 prod = 1 prod = 2 prod = 2 prod = 1 prod = 2 prod = 4 prod = 8 prod = 1 prod = 2 prod = 4 prod = 1 prod = 2 prod = 4 prod = 8 prod = 1 prod = 2 prod = 2 prod = 1 prod = 2 prod = 4 prod = 1 prod = 2 prod = 1 prod = 2 prod = 4 prod = 8 prod = 16 prod = 1 prod = 2 prod = 2 prod = 4 prod = 1 prod = 2 prod = 6 prod = 12 prod = 24 prod = 1 prod = 2 prod = 2 prod = 6 prod = 1 prod = 3 prod = 6 prod = 12 prod = 3 prod = 1 prod = 2 prod = 1 prod = 5 prod = 10 prod = 5 prod = 1 prod = 1 prod = 2 prod = 4 prod = 8 prod = 16 prod = 1 prod = 2 prod = 4 prod = 2 prod = 1 prod = 2 prod = 4 prod = 8 prod = 2 prod = 1 prod = 2 prod = 1 prod = 4 prod = 16 prod = 1 prod = 4 prod = 1 prod = 3 prod = 6 prod = 12 prod = 1 prod = 2 prod = 3 prod = 1 prod = 2 prod = 4 prod = 8 prod = 1 prod = 2 prod = 4