Cody

Solution 1523762

Submitted on 9 May 2018 by Nicolas
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))

prime_factors = 1

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

prime_ok = 1 prime_factors = 2

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

prime_ok = 1 prime_factors = 3 prime_factors_powers = 1 P = 1

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

prime_ok = 1 prime_factors = 7 prime_factors_powers = 1 P = 1

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

prime_ok = 1 prime_factors = 3 3 prime_factors_powers = 2 P = 2

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

prime_ok = 1 prime_factors = 3 5 prime_factors_powers = 1 1 P = 3

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

prime_ok = 1 prime_factors = 2 3 3 prime_factors_powers = 2 P = 2

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

prime_ok = 1 prime_factors = 3 7 prime_factors_powers = 1 1 P = 3

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

prime_ok = 1 prime_factors = 2 2 2 2 2 2 2 2 2 2

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

prime_ok = 1 prime_factors = 5 5 41 prime_factors_powers = 2 1 P = 5

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

prime_ok = 1 prime_factors = 3 5 41 41 prime_factors_powers = 1 1 2 P = 11

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

prime_ok = 1 prime_factors = 2 31 prime_factors_powers = 1 P = 1

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

prime_ok = 1 prime_factors = 3 3 7 prime_factors_powers = 2 1 P = 5

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

prime_ok = 1 prime_factors = 5 13 prime_factors_powers = 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))

prime_ok = 1 prime_factors = 2 2 59 149 157 167 prime_factors_powers = 1 1 1 1 P = 15

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

prime_ok = 1 prime_factors = 2 3 2333 13997 prime_factors_powers = 1 1 1 P = 7 prime_ok = 1 prime_factors = 2 3 2333 prime_factors_powers = 1 1 P = 3 prime_ok = 1 prime_factors = 13997 prime_factors_powers = 1 P = 1 prime_ok = 1 prime_factors = 2 2 2 2 5 13 13 541 prime_factors_powers = 1 2 1 P = 11 prime_ok = 1 prime_factors = 5 541 prime_factors_powers = 1 1 P = 3 prime_ok = 1 prime_factors = 2 2 2 2 13 13 prime_factors_powers = 2 P = 2 prime_ok = 1 prime_factors = 2 7 521 1823 prime_factors_powers = 1 1 1 P = 7 prime_ok = 1 prime_factors = 7 521 prime_factors_powers = 1 1 P = 3 prime_ok = 1 prime_factors = 2 1823 prime_factors_powers = 1 P = 1 prime_ok = 1 prime_factors = 2 2 2 3 7 491 1289 prime_factors_powers = 1 1 1 1 P = 15 prime_ok = 1 prime_factors = 2 2 2 1289 prime_factors_powers = 1 P = 1 prime_ok = 1 prime_factors = 3 7 491 prime_factors_powers = 1 1 1 P = 7 prime_ok = 1 prime_factors = 2 2 7 23 47 59 211 prime_factors_powers = 1 1 1 1 1 P = 31 prime_ok = 1 prime_factors = 2 2 23 211 prime_factors_powers = 1 1 P = 3 prime_ok = 1 prime_factors = 7 47 59 prime_factors_powers = 1 1 1 P = 7 prime_ok = 1 prime_factors = 2 5 17 509 3461 prime_factors_powers = 1 1 1 1 P = 15 prime_ok = 1 prime_factors = 2 17 509 prime_factors_powers = 1 1 P = 3 prime_ok = 1 prime_factors = 5 3461 prime_factors_powers = 1 1 P = 3 prime_ok = 1 prime_factors = 2 2 2 2 2 3 59 67 109 prime_factors_powers = 1 1 1 1 P = 15 prime_ok = 1 prime_factors = 2 2 2 2 2 3 67 prime_factors_powers = 1 1 P = 3 prime_ok = 1 prime_factors = 59 109 prime_factors_powers = 1 1 P = 3 prime_ok = 1 prime_factors = 2 5 2297 5743 prime_factors_powers = 1 1 1 P = 7 prime_ok = 1 prime_factors = 2 5743 prime_factors_powers = 1 P = 1 prime_ok = 1 prime_factors = 5 2297 prime_factors_powers = 1 1 P = 3 prime_ok = 1 prime_factors = 2 3 7 13 67 83 prime_factors_powers = 1 1 1 1 1 P = 31 prime_ok = 1 prime_factors = 3 7 83 prime_factors_powers = 1 1 1 P = 7 prime_ok = 1 prime_factors = 2 13 67 prime_factors_powers = 1 1 P = 3 prime_ok = 1 prime_factors = 2 2 2 2 2 3 491 5237 prime_factors_powers = 1 1 1 P = 7 prime_ok = 1 prime_factors = 2 2 2 2 2 491 prime_factors_powers = 1 P = 1 prime_ok = 1 prime_factors = 3 5237 prime_factors_powers = 1 1 P = 3 prime_ok = 1 prime_factors = 2 2 2 2 3 3 3 3 3 3 5 5 17 67 prime_factors_powers = 6 2 1 1 P = 83 prime_ok = 1 prime_factors = 3 3 3 3 3 3 5 5 prime_factors_powers = 6 2 P = 20 prime_ok = 1 prime_factors = 2 2 2 2 17 67 prime_factors_powers = 1 1 P = 3 prime_ok = 1 prime_factors = 2 3 19 47 107 397 prime_factors_powers = 1 1 1 1 1 P = 31 prime_ok = 1 prime_factors = 3 47 107 prime_factors_powers = 1 1 1 P = 7 prime_ok = 1 prime_factors = 2 19 397 prime_factors_powers = 1 1 P = 3 prime_ok = 1 prime_factors = 2 2 3 7 71 89 677 prime_factors_powers = 1 1 1 1 1 P = 31 prime_ok = 1 prime_factors = 3 71 89 prime_factors_powers = 1 1 1 P = 7 prime_ok = 1 prime_factors = 2 2 7 677 prime_factors_powers = 1 1 P = 3 prime_ok = 1 prime_factors = 2 3 3 3 5 41 11071 prime_factors_powers = 3 1 1 1 P = 31 prime_ok = 1 prime_factors = 11071 prime_factors_powers = 1 P = 1 prime_ok = 1 prime_factors = 2 3 3 3 5 41 prime_factors_powers = 3 1 1 P = 15 prime_ok = 1 prime_factors = 2 3 3 3 19 29 43 173 prime_factors_powers = 3 1 1 1 1 P = 63 prime_ok = 1 prime_factors = 2 43 173 prime_factors_powers = 1 1 P = 3 prime_ok = 1 prime_factors = 3 3 3 19 29 prime_factors_powers = 3 1 1 P = 15 prime_ok = 1 prime_factors = 2 2 2 3 3 3 3 19 23 29 43 prime_factors_powers = 4 1 1 1 1 P = 79 prime_ok = 1 prime_factors = 2 2 2 3 3 3 3 29 prime_factors_powers = 4 1 P = 9 prime_ok = 1 prime_factors = 19 23 43 prime_factors_powers = 1 1 1 P = 7 prime_ok = 1 prime_factors = 2 2 3 5 7 521 547 prime_factors_powers = 1 1 1 1 1 P = 31 prime_ok = 1 prime_factors = 3 7 521 prime_factors_powers = 1 1 1 P = 7 prime_ok = 1 prime_factors = 2 2 5 547 prime_factors_powers = 1 1 P = 3 prime_ok = 1 prime_factors = 2 2 3 13 151 2617 prime_factors_powers = 1 1 1 1 P = 15 prime_ok = 1 prime_factors = 2 2 13 151 prime_factors_powers = 1 1 P = 3 prime_ok = 1 prime_factors = 3 2617 prime_factors_powers = 1 1 P = 3 prime_ok = 1 prime_factors = 2 2 2 3 5 7 13 223 prime_factors_powers = 1 1 1 1 1 P = 31 prime_ok = 1 prime_factors = 7 223 prime_factors_powers = 1 1 P = 3 prime_ok = 1 prime_factors = 2 2 2 3 5 13 prime_factors_powers = 1 1 1 P = 7 prime_ok = 1 prime_factors = 2 2 2 2 2 3 3 3 3 5 13 997 prime_factors_powers = 4 1 1 1 P = 39 prime_ok = 1 prime_factors = 13 997 prime_factors_powers = 1 1 P = 3 prime_ok = 1 prime_factors = 2 2 2 2 2 3 3 3 3 5 prime_factors_powers = 4 1 P = 9