Cody

Solution 811456

Submitted on 21 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 = 3; assert(isequal(Nth_polite(x),y_correct))

kk = 2 ans = 4 polite = 3

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

kk = 2 ans = 4 kk = 3 ans = 8 polite = 5

3   Pass
%% x = 4; y_correct = 7; assert(isequal(Nth_polite(x),y_correct))

kk = 2 ans = 4 kk = 3 ans = 8 polite = 7

4   Pass
%% x = 5; y_correct = 9; assert(isequal(Nth_polite(x),y_correct))

kk = 2 ans = 4 kk = 3 ans = 8 kk = 4 ans = 16 polite = 9

5   Pass
%% x = 7; y_correct = 11; assert(isequal(Nth_polite(x),y_correct))

kk = 2 ans = 4 kk = 3 ans = 8 kk = 4 ans = 16 polite = 11

6   Pass
%% x = 11; y_correct = 15; assert(isequal(Nth_polite(x),y_correct))

kk = 2 ans = 4 kk = 3 ans = 8 kk = 4 ans = 16 polite = 15

7   Pass
%% x = 12; y_correct = 17; assert(isequal(Nth_polite(x),y_correct))

kk = 2 ans = 4 kk = 3 ans = 8 kk = 4 ans = 16 kk = 5 ans = 32 polite = 17

8   Pass
%% x = 14; y_correct = 19; assert(isequal(Nth_polite(x),y_correct))

kk = 2 ans = 4 kk = 3 ans = 8 kk = 4 ans = 16 kk = 5 ans = 32 polite = 19

9   Pass
%% x = 19; y_correct = 24; assert(isequal(Nth_polite(x),y_correct))

kk = 2 ans = 4 kk = 3 ans = 8 kk = 4 ans = 16 kk = 5 ans = 32 polite = 24

10   Pass
%% x = 21; y_correct = 26; assert(isequal(Nth_polite(x),y_correct))

kk = 2 ans = 4 kk = 3 ans = 8 kk = 4 ans = 16 kk = 5 ans = 32 polite = 26

11   Pass
%% x = 27; y_correct = 33; assert(isequal(Nth_polite(x),y_correct))

kk = 2 ans = 4 kk = 3 ans = 8 kk = 4 ans = 16 kk = 5 ans = 32 kk = 6 ans = 64 polite = 33

12   Pass
%% x = 64; y_correct = 71; assert(isequal(Nth_polite(x),y_correct))

kk = 2 ans = 4 kk = 3 ans = 8 kk = 4 ans = 16 kk = 5 ans = 32 kk = 6 ans = 64 kk = 7 ans = 128 polite = 71

13   Pass
%% x = 1e6; y_correct = x+20; assert(isequal(Nth_polite(x),y_correct))

kk = 2 ans = 4 kk = 3 ans = 8 kk = 4 ans = 16 kk = 5 ans = 32 kk = 6 ans = 64 kk = 7 ans = 128 kk = 8 ans = 256 kk = 9 ans = 512 kk = 10 ans = 1024 kk = 11 ans = 2048 kk = 12 ans = 4096 kk = 13 ans = 8192 kk = 14 ans = 16384 kk = 15 ans = 32768 kk = 16 ans = 65536 kk = 17 ans = 131072 kk = 18 ans = 262144 kk = 19 ans = 524288 kk = 20 ans = 1048576 polite = 1000020

14   Pass
%% x = 1e7; y_correct = x+24; assert(isequal(Nth_polite(x),y_correct))

kk = 2 ans = 4 kk = 3 ans = 8 kk = 4 ans = 16 kk = 5 ans = 32 kk = 6 ans = 64 kk = 7 ans = 128 kk = 8 ans = 256 kk = 9 ans = 512 kk = 10 ans = 1024 kk = 11 ans = 2048 kk = 12 ans = 4096 kk = 13 ans = 8192 kk = 14 ans = 16384 kk = 15 ans = 32768 kk = 16 ans = 65536 kk = 17 ans = 131072 kk = 18 ans = 262144 kk = 19 ans = 524288 kk = 20 ans = 1048576 kk = 21 ans = 2097152 kk = 22 ans = 4194304 kk = 23 ans = 8388608 kk = 24 ans = 16777216 polite = 10000024

15   Pass
%% x = 999999999; y_correct = x+30; assert(isequal(Nth_polite(x),y_correct))

kk = 2 ans = 4 kk = 3 ans = 8 kk = 4 ans = 16 kk = 5 ans = 32 kk = 6 ans = 64 kk = 7 ans = 128 kk = 8 ans = 256 kk = 9 ans = 512 kk = 10 ans = 1024 kk = 11 ans = 2048 kk = 12 ans = 4096 kk = 13 ans = 8192 kk = 14 ans = 16384 kk = 15 ans = 32768 kk = 16 ans = 65536 kk = 17 ans = 131072 kk = 18 ans = 262144 kk = 19 ans = 524288 kk = 20 ans = 1048576 kk = 21 ans = 2097152 kk = 22 ans = 4194304 kk = 23 ans = 8388608 kk = 24 ans = 16777216 kk = 25 ans = 33554432 kk = 26 ans = 67108864 kk = 27 ans = 134217728 kk = 28 ans = 268435456 kk = 29 ans = 536870912 kk = 30 ans = 1.0737e+09 polite = 1.0000e+09

Suggested Problems

More from this Author41