Cody

Solution 808089

Submitted on 16 Jan 2016 by Shishir Patel
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))

fac = 1 fac2 = [] a = Empty matrix: 0-by-1 P = 0

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

fac = 2 fac2 = [] a = Empty matrix: 0-by-1 P = 0

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

fac = 3 fac2 = 3 a = 3 b = 1 P = 1

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

fac = 7 fac2 = 7 a = 7 b = 1 P = 1

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

fac = 3 3 fac2 = 3 3 a = 3 b = 2 P = 2

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

fac = 3 5 fac2 = 3 5 a = 3 5 b = 1 b = 1 1 P = 3

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

fac = 2 3 3 fac2 = 3 3 a = 3 b = 2 P = 2

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

fac = 3 7 fac2 = 3 7 a = 3 7 b = 1 b = 1 1 P = 3

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

fac = 2 2 2 2 2 2 2 2 2 2 fac2 = Empty matrix: 1-by-0 a = Empty matrix: 1-by-0 P = 0

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

fac = 5 5 41 fac2 = 5 5 41 a = 5 41 b = 2 b = 2 1 P = 5

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

fac = 3 5 41 41 fac2 = 3 5 41 41 a = 3 5 41 b = 1 b = 1 1 b = 1 1 2 P = 11

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

fac = 2 31 fac2 = 31 a = 31 b = 1 P = 1

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

fac = 3 3 7 fac2 = 3 3 7 a = 3 7 b = 2 b = 2 1 P = 5

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

fac = 5 13 fac2 = 5 13 a = 5 13 b = 1 b = 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))

fac = 2 2 2 2 2 107 181 fac2 = 107 181 a = 107 181 b = 1 b = 1 1 P = 3

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

fac = 2 41 67 1373 fac2 = 41 67 1373 a = 41 67 1373 b = 1 b = 1 1 b = 1 1 1 P = 7 fac = 41 67 fac2 = 41 67 a = 41 67 b = 1 b = 1 1 P = 3 fac = 2 1373 fac2 = 1373 a = 1373 b = 1 P = 1 fac = 2 2 3 5 389 2593 fac2 = 3 5 389 2593 a = 3 5 389 2593 b = 1 b = 1 1 b = 1 1 1 b = 1 1 1 1 P = 15 fac = 2 2 5 389 fac2 = 5 389 a = 5 389 b = 1 b = 1 1 P = 3 fac = 3 2593 fac2 = 3 2593 a = 3 2593 b = 1 b = 1 1 P = 3 fac = 2 3 3 53 139 1637 fac2 = 3 3 53 139 1637 a = 3 53 139 1637 b = 2 b = 2 1 b = 2 1 1 b = 2 1 1 1 P = 23 fac = 2 53 139 fac2 = 53 139 a = 53 139 b = 1 b = 1 1 P = 3 fac = 3 3 1637 fac2 = 3 3 1637 a = 3 1637 b = 2 b = 2 1 P = 5 fac = 2 2 2 3 5 311 1493 fac2 = 3 5 311 1493 a = 3 5 311 1493 b = 1 b = 1 1 b = 1 1 1 b = 1 1 1 1 P = 15 fac = 5 1493 fac2 = 5 1493 a = 5 1493 b = 1 b = 1 1 P = 3 fac = 2 2 2 3 311 fac2 = 3 311 a = 3 311 b = 1 b = 1 1 P = 3 fac = 2 2 2 2 3 199 9551 fac2 = 3 199 9551 a = 3 199 9551 b = 1 b = 1 1 b = 1 1 1 P = 7 fac = 2 2 2 2 3 199 fac2 = 3 199 a = 3 199 b = 1 b = 1 1 P = 3 fac = 9551 fac2 = 9551 a = 9551 b = 1 P = 1 fac = 2 3 37 37 43 191 fac2 = 3 37 37 43 191 a = 3 37 43 191 b = 1 b = 1 2 b = 1 2 1 b = 1 2 1 1 P = 23 fac = 2 3 37 37 fac2 = 3 37 37 a = 3 37 b = 1 b = 1 2 P = 5 fac = 43 191 fac2 = 43 191 a = 43 191 b = 1 b = 1 1 P = 3 fac = 2 2 2 5 13 53 163 fac2 = 5 13 53 163 a = 5 13 53 163 b = 1 b = 1 1 b = 1 1 1 b = 1 1 1 1 P = 15 fac = 2 2 2 5 53 fac2 = 5 53 a = 5 53 b = 1 b = 1 1 P = 3 fac = 13 163 fac2 = 13 163 a = 13 163 b = 1 b = 1 1 P = 3 fac = 2 7 29 263 2179 fac2 = 7 29 263 2179 a = 7 29 263 2179 b = 1 b = 1 1 b = 1 1 1 b = 1 1 1 1 P = 15 fac = 2 29 263 fac2 = 29 263 a = 29 263 b = 1 b = 1 1 P = 3 fac = 7 2179 fac2 = 7 2179 a = 7 2179 b = 1 b = 1 1 P = 3 fac = 2 2 3 3 11 59 193 fac2 = 3 3 11 59 193 a = 3 11 59 193 b = 2 b = 2 1 b = 2 1 1 b = 2 1 1 1 P = 23 fac = 2 2 3 3 59 fac2 = 3 3 59 a = 3 59 b = 2 b = 2 1 P = 5 fac = 11 193 fac2 = 11 193 a = 11 193 b = 1 b = 1 1 P = 3 fac = 2 2 2 11 19 179 829 fac2 = 11 19 179 829 a = 11 19 179 829 b = 1 b = 1 1 b = 1 1 1 b = 1 1 1 1 P = 15 fac = 2 2 2 11 179 fac2 = 11 179 a = 11 179 b = 1 b = 1 1 P = 3 fac = 19 829 fac2 = 19 829 a = 19 829 b = 1 b = 1 1 P = 3 fac = 2 2 2 2 3 11 367 757 fac2 = 3 11 367 757 a = 3 11 367 757 b = 1 b = 1 1 b = 1 1 1 b = 1 1 1 1 P = 15 fac = 2 2 2 2 757 fac2 = 757 a = 757 b = 1 P = 1 fac = 3 11 367 fac2 = 3 11 367 a = 3 11 367 b = 1 b = 1 1 b = 1 1 1 P = 7 fac = 2 2 3 5 5 13 13 3169 fac2 = 3 5 5 13 13 3169 a = 3 5 13 3169 b = 1 b = 1 2 b = 1 2 2 b = 1 2 2 1 P = 35 fac = 2 2 3169 fac2 = 3169 a = 3169 b = 1 P = 1 fac = 3 5 5 13 13 fac2 = 3 5 5 13 13 a = 3 5 13 b = 1 b = 1 2 b = 1 2 2 P = 17 fac = 2 2 7 31 101 1789 fac2 = 7 31 101 1789 a = 7 31 101 1789 b = 1 b = 1 1 b = 1 1 1 b = 1 1 1 1 P = 15 fac = 2 2 31 101 fac2 = 31 101 a = 31 101 b = 1 b = 1 1 P = 3 fac = 7 1789 fac2 = 7 1789 a = 7 1789 b = 1 b = 1 1 P = 3 fac = 2 7 31 109 fac2 = 7 31 109 a = 7 31 109 b = 1 b = 1 1 b = 1 1 1 P = 7 fac = 2 109 fac2 = 109 a = 109 b = 1 P = 1 fac = 7 31 fac2 = 7 31 a = 7 31 b = 1 b = 1 1 P = 3 fac = 2 2 2 2 2 7 11 31 1559 fac2 = 7 11 31 1559 a = 7 11 31 1559 b = 1 b = 1 1 b = 1 1 1 b = 1 1 1 1 P = 15 fac = 7 1559 fac2 = 7 1559 a = 7 1559 b = 1 b = 1 1 P = 3 fac = 2 2 2 2 2 11 31 fac2 = 11 31 a = 11 31 b = 1 b = 1 1 P = 3 fac = 2 2003 4007 fac2 = 2003 4007 a = 2003 4007 b = 1 b = 1 1 P = 3 fac = 4007 fac2 = 4007 a = 4007 b = 1 P = 1 fac = 2 2003 fac2 = 2003 a = 2003 b = 1 P = 1 fac = 2 2 3 4243 5657 fac2 = 3 4243 5657 a = 3 4243 5657 b = 1 b = 1 1 b = 1 1 1 P = 7 fac = 2 2 4243 fac2 = 4243 a = 4243 b = 1 P = 1 fac = 3 5657 fac2 = 3 5657 a = 3 5657 b = 1 b = 1 1 P = 3 fac = 2 3 3 7 83 10459 fac2 = 3 3 7 83 10459 a = 3 7 83 10459 b = 2 b = 2 1 b = 2 1 1 b = 2 1 1 1 P = 23 fac = 10459 fac2 = 10459 a = 10459 b = 1 P = 1 fac = 2 3 3 7 83 fac2 = 3 3 7 83 a = 3 7 83 b = 2 b = 2 1 b = 2 1 1 P = 11 fac = 2 2 2 2 2 2 3 7 47 1289 fac2 = 3 7 47 1289 a = 3 7 47 1289 b = 1 b = 1 1 b = 1 1 1 b = 1 1 1 1 P = 15 fac = 2 2 2 2 2 2 3 47 fac2 = 3 47 a = 3 47 b = 1 b = 1 1 P = 3 fac = 7 1289 fac2 = 7 1289 a = 7 1289 b = 1 b = 1 1 P = 3 fac = 2 3 23 29 4003 fac2 = 3 23 29 4003 a = 3 23 29 4003 b = 1 b = 1 1 b = 1 1 1 b = 1 1 1 1 P = 15 fac = 4003 fac2 = 4003 a = 4003 b = 1 P = 1 fac = 2 3 23 29 fac2 = 3 23 29 a = 3 23 29 b = 1 b = 1 1 b = 1 1 1 P = 7