Cody

Problem 273. Recurring Cycle Length (Inspired by Project Euler Problem 26)

Solution 2084705

Submitted on 9 Jan 2020 by Asif Newaz
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(recurring_cycle(x),y_correct))

a = 0

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

a = 1 x = [] b = 10 y = 1 a = 0

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

a = 1 x = [] b = 10 y = 1 a = 1 x = 1 b = 10 y = 1 1 a = 1 x = 1 2

4   Pass
x = 4; y_correct = 0; assert(isequal(recurring_cycle(x),y_correct))

a = 1 x = [] b = 10 y = 1 a = 2 x = [] b = 20 y = 1 2 a = 0

5   Pass
x = 5; y_correct = 0; assert(isequal(recurring_cycle(x),y_correct))

a = 1 x = [] b = 10 y = 1 a = 0

6   Pass
x = 6; y_correct = 1; assert(isequal(recurring_cycle(x),y_correct))

a = 1 x = [] b = 10 y = 1 a = 4 x = [] b = 40 y = 1 4 a = 4 x = 2 b = 40 y = 1 4 4 a = 4 x = 2 3

7   Pass
x = 7; y_correct = 6; assert(isequal(recurring_cycle(x),y_correct))

a = 1 x = [] b = 10 y = 1 a = 3 x = [] b = 30 y = 1 3 a = 2 x = 1×0 empty double row vector b = 20 y = 1 3 2 a = 6 x = 1×0 empty double row vector b = 60 y = 1 3 2 6 a = 4 x = 1×0 empty double row vector b = 40 y = 1 3 2 6 4 a = 5 x = 1×0 empty double row vector b = 50 y = 1 3 2 6 4 5 a = 1 x = 1 b = 10 y = 1 3 2 6 4 5 1 a = 3 x = 2 b = 30 y = 1 3 2 6 4 5 1 3 a = 2 x = 3 b = 20 y = 1 3 2 6 4 5 1 3 2 a = 6 x = 4 b = 60 y = 1 3 2 6 4 5 1 3 2 6 a = 4 x = 5 b = 40 y = 1 3 2 6 4 5 1 3 2 6 4 a = 5 x = 6 b = 50 y = 1 3 2 6 4 5 1 3 2 6 4 5 a = 1 x = 1 7

8   Pass
x = 8; y_correct = 0; assert(isequal(recurring_cycle(x),y_correct))

a = 1 x = [] b = 10 y = 1 a = 2 x = [] b = 20 y = 1 2 a = 4 x = 1×0 empty double row vector b = 40 y = 1 2 4 a = 0

9   Pass
x = 9; y_correct = 1; assert(isequal(recurring_cycle(x),y_correct))

a = 1 x = [] b = 10 y = 1 a = 1 x = 1 b = 10 y = 1 1 a = 1 x = 1 2

10   Pass
x = 10; y_correct = 0; assert(isequal(recurring_cycle(x),y_correct))

a = 1 x = [] b = 10 y = 1 a = 0

11   Pass
x = 17; y_correct = 16; assert(isequal(recurring_cycle(x),y_correct))

a = 1 x = [] b = 10 y = 1 a = 10 x = [] b = 100 y = 1 10 a = 15 x = 1×0 empty double row vector b = 150 y = 1 10 15 a = 14 x = 1×0 empty double row vector b = 140 y = 1 10 15 14 a = 4 x = 1×0 empty double row vector b = 40 y = 1 10 15 14 4 a = 6 x = 1×0 empty double row vector b = 60 y = 1 10 15 14 4 6 a = 9 x = 1×0 empty double row vector b = 90 y = 1 10 15 14 4 6 9 a = 5 x = 1×0 empty double row vector b = 50 y = 1 10 15 14 4 6 9 5 a = 16 x = 1×0 empty double row vector b = 160 y = 1 10 15 14 4 6 9 5 16 a = 7 x = 1×0 empty double row vector b = 70 y = 1 10 15 14 4 6 9 5 16 7 a = 2 x = 1×0 empty double row vector b = 20 y = 1 10 15 14 4 6 9 5 16 7 2 a = 3 x = 1×0 empty double row vector b = 30 y = 1 10 15 14 4 6 9 5 16 7 2 3 a = 13 x = 1×0 empty double row vector b = 130 y = 1 10 15 14 4 6 9 5 16 7 2 3 13 a = 11 x = 1×0 empty double row vector b = 110 y = 1 10 15 14 4 6 9 5 16 7 2 3 13 11 a = 8 x = 1×0 empty double row vector b = 80 y = 1 10 15 14 4 6 9 5 16 7 2 3 13 11 8 a = 12 x = 1×0 empty double row vector b = 120 y = 1 10 15 14 4 6 9 5 16 7 2 3 13 11 8 12 a = 1 x = 1 b = 10 y = 1 10 15 14 4 6 9 5 16 7 2 3 13 11 8 12 1 a = 10 x = 2 b = 100 y = 1 10 15 14 4 6 9 5 16 7 2 3 13 11 8 12 1 10 a = 15 x = 3 b = 150 y = 1 10 15 14 4 6 9 5 16 7 2 3 13 11 8 12 1 10 15 a = 14 x = 4 b = 140 y = 1 10 15 14 4 6 9 5 16 7 2 3 13 11 8 12 1 10 15 14 a = 4 x = 5 b = 40 y = 1 10 15 14 4 6 9 5 16 7 2 3 13 11 8 12 1 10 15 14 4 a = 6 x = 6 b = 60 y = 1 10 15 14 4 6 9 5 16 7 2 3 13 11 8 12 1 10 15 14 4 6 a = 9 x = 7 b = 90 y = 1 10 15 14 4 6 9 5 16 7 2 3 13 11 8 12 1 10 15 14 4 6 9 a = 5 x = 8 b = 50 y = 1 10 15 14 4 6 9 5 16 7 2 3 13 11 8 12 1 10 15 14 4 6 9 5 a = 16 x = 9 b = 160 y = 1 10 15 14 4 6 9 5 16 7 2 3 13 11 8 12 1 10 15 14 4 6 9 5 16 a = 7 x = 10 b = 70 y = 1 10 15 14 4 6 9 5 16 7 2 3 13 11 8 12 1 10 15 14 4 6 9 5 16 7 a = 2 x = 11 b = 20 y = 1 10 15 14 4 6 9 5 16 7 2 3 13 11 8 12 1 10 15 14 4 6 9 5 16 7 2 a = 3 x = 12 b = 30 y = 1 10 15 14 4 6 9 5 16 7 2 3 13 11 8 12 1 10 15 14 4 6 9 5 16 7 2 3 a = 13 x = 13 b = 130 y = 1 10 15 14 4 6 9 5 16 7 2 3 13 11 8 12 1 10 15 14 4 6 9 5 16 7 2 3 13 a = 11 x = 14 b = 110 y = 1 10 15 14 4 6 9 5 16 7 2 3 13 11 8 12 1 10 15 14 4 6 9 5 16 7 2 3 13 11 a = 8 x = 15 b = 80 y = Columns 1 through 30 1 10 15 14 4 6 9 5 16 7 2 3 13 11 8 12 1 10 15 14 4 6 9 5 16 7 2 3 13 11 Column 31 8 a = 12 x = 16 b = 120 y = Columns 1 through 30 1 10 15 14 4 6 9 5 16 7 2 3 13 11 8 12 1 10 15 14 4 6 9 5 16 7 2 3 13 11 Columns 31 through 32 8 12 a = 1 x = 1 17

12   Pass
x = 19; y_correct = 18; assert(isequal(recurring_cycle(x),y_correct))

a = 1 x = [] b = 10 y = 1 a = 10 x = [] b = 100 y = 1 10 a = 5 x = 1×0 empty double row vector b = 50 y = 1 10 5 a = 12 x = 1×0 empty double row vector b = 120 y = 1 10 5 12 a = 6 x = 1×0 empty double row vector b = 60 y = 1 10 5 12 6 a = 3 x = 1×0 empty double row vector b = 30 y = 1 10 5 12 6 3 a = 11 x = 1×0 empty double row vector b = 110 y = 1 10 5 12 6 3 11 a = 15 x = 1×0 empty double row vector b = 150 y = 1 10 5 12 6 3 11 15 a = 17 x = 1×0 empty double row vector b = 170 y = 1 10 5 12 6 3 11 15 17 a = 18 x = 1×0 empty double row vector b = 180 y = 1 10 5 12 6 3 11 15 17 18 a = 9 x = 1×0 empty double row vector b = 90 y = 1 10 5 12 6 3 11 15 17 18 9 a = 14 x = 1×0 empty double row vector b = 140 y = 1 10 5 12 6 3 11 15 17 18 9 14 a = 7 x = 1×0 empty double row vector b = 70 y = 1 10 5 12 6 3 11 15 17 18 9 14 7 a = 13 x = 1×0 empty double row vector b = 130 y = 1 10 5 12 6 3 11 15 17 18 9 14 7 13 a = 16 x = 1×0 empty double row vector b = 160 y = 1 10 5 12 6 3 11 15 17 18 9 14 7 13 16 a = 8 x = 1×0 empty double row vector b = 80 y = 1 10 5 12 6 3 11 15 17 18 9 14 7 13 16 8 a = 4 x = 1×0 empty double row vector b = 40 y = 1 10 5 12 6 3 11 15 17 18 9 14 7 13 16 8 4 a = 2 x = 1×0 empty double row vector b = 20 y = 1 10 5 12 6 3 11 15 17 18 9 14 7 13 16 8 4 2 a = 1 x = 1 b = 10 y = 1 10 5 12 6 3 11 15 17 18 9 14 7 13 16 8 4 2 1 a = 10 x = 2 b = 100 y = 1 10 5 12 6 3 11 15 17 18 9 14 7 13 16 8 4 2 1 10 a = 5 x = 3 b = 50 y = 1 10 5 12 6 3 11 15 17 18 9 14 7 13 16 8 4 2 1 10 5 a = 12 x = 4 b = 120 y = 1 10 5 12 6 3 11 15 17 18 9 14 7 13 16 8 4 2 1 10 5 12 a = 6 x = 5 b = 60 y = 1 10 5 12 6 3 11 15 17 18 9 14 7 13 16 8 4 2 1 10 5 12 6 a = 3 x = 6 b = 30 y = 1 10 5 12 6 3 11 15 17 18 9 14 7 13 16 8 4 2 1 10 5 12 6 3 a = 11 x = 7 b = 110 y = 1 10 5 12 6 3 11 15 17 18 9 14 7 13 16 8 4 2 1 10 5 12 6 3 11 a = 15 x = 8 b = 150 y = 1 10 5 12 6 3 11 15 17 18 9 14 7 13 16 8 4 2 1 10 5 12 6 3 11 15 a = 17 x = 9 b = 170 y = 1 10 5 12 6 3 11 15 17 18 9 14 7 13 16 8 4 2 1 10 5 12 6 3 11 15 17 a = 18 x = 10 b = 180 y = 1 10 5 12 6 3 11 15 17 18 9 14 7 13 16 8 4 2 1 10 5 12 6 3 11 15 17 18 a = 9 x = 11 b = 90 y = 1 10 5 12 6 3 11 15 17 18 9 14 7 13 16 8 4 2 1 10 5 12 6 3 11 15 17 18 9 a = 14 x = 12 b = 140 y = 1 10 5 12 6 3 11 15 17 18 9 14 7 13 16 8 4 2 1 10 5 12 6 3 11 15 17 18 9 14 a = 7 x = 13 b = 70 y = Columns 1 through 30 1 10 5 12 6 3 11 15 17 18 9 14 7 13 16 8 4 2 1 10 5 12 6 3 11 15 17 18 9 14 Column 31 7 a = 13 x = 14 b = 130 y = Columns 1 through 30 1 10 5 12 6 3 11 15 17 18 9 14 7 13 16 8 4 2 1 10 5 12 6 3 11 15 17 18 9 14 Columns 31 through 32 7 13 a = 16 x = 15 b = 160 y = Columns 1 through 30 1 10 5 12 6 3 11 15 17 18 9 14 7 13 16 8 4 2 1 10 5 12 6 3 11 15 17 18 9 14 Columns 31 through 33 7 13 16 a = 8 x = 16 b = 80 y = Columns 1 through 30 1 10 5 12 6 3 11 15 17 18 9 14 7 13 16 8 4 2 1 10 5 12 6 3 11 15 17 18 9 14 Columns 31 through 34 7 13 16 8 a = 4 x = 17 b = 40 y = Columns 1 through 30 1 10 5 12 6 3 11 15 17 18 9 14 7 13 16 8 4 2 1 10 5 12 6 3 11 15 17 18 9 14 Columns 31 through 35 7 13 16 8 4 a = 2 x = 18 b = 20 y = Columns 1 through 30 1 10 5 12 6 3 11 15 17 18 9 14 7 13 16 8 4 2 1 10 5 12 6 3 11 15 17 18 9 14 Columns 31 through 36 7 13 16 8 4 2 a = 1 x = 1 19

13   Pass
x = 197; y_correct = 98; assert(isequal(recurring_cycle(x),y_correct))

a = 1 x = [] b = 10 y = 1 a = 10 x = [] b = 100 y = 1 10 a = 100 x = 1×0 empty double row vector b = 1000 y = 1 10 100 a = 15 x = 1×0 empty double row vector b = 150 y = 1 10 100 15 a = 150 x = 1×0 empty double row vector b = 1500 y = 1 10 100 15 150 a = 121 x = 1×0 empty double row vector b = 1210 y = 1 10 100 15 150 121 a = 28 x = 1×0 empty double row vector b = 280 y = 1 10 100 15 150 121 28 a = 83 x = 1×0 empty double row vector b = 830 y = 1 10 100 15 150 121 28 83 a = 42 x = 1×0 empty double row vector b = 420 y = 1 10 100 15 150 121 28 83 42 a = 26 x = 1×0 empty double row vector b = 260 y = 1 10 100 15 150 121 28 83 42 26 a = 63 x = 1×0 empty double row vector b = 630 y = 1 10 100 15 150 121 28 83 42 26 63 a = 39 x = 1×0 empty double row vector b = 390 y = 1 10 100 15 150 121 28 83 42 26 63 39 a = 193 x = 1×0 empty double row vector b = 1930 y = 1 10 100 15 150 121 28 83 42 26 63 39 193 a = 157 x = 1×0 empty double row vector b = 1570 y = 1 10 100 15 150 121 28 83 42 26 63 39 193 157 a = 191 x = 1×0 empty double row vector b = 1910 y = 1 10 100 15 150 121 28 83 42 26 63 39 193 157 191 a = 137 x = 1×0 empty double row vector b = 1370 y = 1 10 100 15 150 121 28 83 42 26 63 39 193 157 191 137 a = 188 x = 1×0 empty double row vector b = 1880 y = 1 10 100 15 150 121 28 83 42 26 63 39 193 157 191 137 188 a = 107 x = 1×0 empty double row vector b = 1070 y = 1 10 100 15 150 121 28 83 42 26 63 39 193 157 191 137 188 107 a = 85 x = 1×0 empty double row vector b = 850 y = 1 10 100 15 150 121 28 83 42 26 63 39 193 157 191 137 188 107 85 a = 62 x = 1×0 empty double row vector b = 620 y = 1 10 100 15 150 121 28 83 42 26 63 39 193 157 191 137 188 107 85 62 a = 29 x = 1×0 empty double row vector b = 290 y = 1 10 100 15 150 121 28 83 42 26 63 39 193 157 191 137 188 107 85 62 29 a = 93 x = 1×0 empty double row vector b = 930 y = 1 10 100 15 150 121 28 83 42 26 63 39 193 157 191 137 188 107 85 62 29 93 a = 142 x = 1×0 empty double row vector b = 1420 y = 1 10 100 15 150 121 28 83 42 26 63 39 193 157 191 137 188 107 85 62 29 93 142 a = 41 x = 1×0 empty double row vector b = 410 y = 1 10 100 15 150 121 28 83 42 26 63 39 193 157 191 137 188 107 85 62 29 93 142 41 a = 16 x = 1×0 empty double row vector b = 160 y = 1 10 100 15 150 121 28 83 42 26 63 39 193 157 191 137 188 107 85 62 29 93 142 41 16 a = 160 x = 1×0 empty double row vector b = 1600 y = 1 10 100 15 150 121 28 83 42 26 63 39 193 157 191 137 188 107 85 62 29 93 142 41 16 160 a = 24 x = 1×0 empty double row vector b = 240 y = 1 10 100 15 150 121 28 83 42 26 63 39 193 157 191 137 188 107 85 62 29 93 142 41 16 160 24 a = 43 x = 1×0 empty double row vector b = 430 y = 1 10 100 15 150 121 28 83 42 26 63 39 193 157 191 137 188 107 85 62 29 93 142 41 16 160 24 43 a = 36 x = 1×0 empty double row vector b = 360 y = 1 10 100 15 150 121 28 83 42 26 63 39 193 157 191 137 188 107 85 62 29 93 142 41 16 160 24 43 36 a = 163 x = 1×0 empty double row vector b = 1630 y = 1 10 100 15 150 121 28 83 42 26 63 39 193 157 191 137 188 107 85 62 29 93 142 41 16 160 24 43 36 163 a = 54 x = 1×0 empty double row vector b = 540 y = Columns 1 through 30 1 10 100 15 150 121 28 83 42 26 63 39 193 157 191 137 188 107 85 62 29 93 142 41 16 160 24 43 36 163 Column 31 54 a = 146 x = 1×0 empty double row vector b = 1460 y = Columns 1 through 30 1 10 100 15 150 121 28 83 42 26 63 39 193 157 191 137 188 107 85 62 29 93 142 41 16 160 24 43 36 163 Columns 31 through 32 54 146 a = 81 x = 1×0 empty double row vector b = 810 y = Columns 1 through 30 1 10 100 15 150 121 28 83 42 26 63 39 193 157 191 137 188 107 85 62 29 93 142 41 16 160 24 43 36 163 Columns 31 through 33 54 146 81 a = 22 x = 1×0 empty double row vector b = 220 y = Columns 1 through 30 1 10 100 15 150 121 28 83 42 26 63 39 193 157 191 137 188 107 85 62 29 93 142 41 16 160 24 43 36 163 Columns 31 through 34 54 146 81 22 a = 23 x = 1×0 empty double row vector b = 230 y = Columns 1 through 30 1 10 100 15 150 121 28 83 42 26 63 39 193 157 191 137 188 107 85 62 29 93 142 41 16 160 24 43 36 163 Columns 31 through 35 54 146 81 22 23 a = 33 x = 1×0 empty double row vector b = 330 y = Columns 1 through 30 1 10 100 15 150 121 28 83 42 26 63 39 193 157 191 137 188 107 85 62 29 93 142 41 16 160 24 43 36 163 Columns 31 through 36 54 146 81 22 23 33 a = 133 x = 1×0 empty double row vector b = 1330 y = Columns 1 through 30 1 10 100 15 150 121 28 83 42 26 63 39 193 157 191 137 188 107 85 62 29 93 142 41 16 160 24 43 36 163 Columns 31 through 37 54 146 81 22 23 33 133 a = 148 x = 1×0 empty double row vector b = 1480 y = Columns 1 through 30 1 10 100 15 150 121 28 83 42 26 63 39 193 157 191 137 188 107 85 62 29 93 142 41 16 160 24 43 36 163 Columns 31 through 38 54 146 81 22 23 33 133 148 a = 101 x = 1×0 empty double row vector b = 1010 y = Columns 1 through 30 1 10 100 15 150 121 28 83 42 26 63 39 193 157 191 137 188 107 85 62 29 93 142 41 16 160 24 43 36 163 Columns 31 through 39 54 146 81 22 23 33 133 148 101 a = 25 x = 1×0 empty double row vector b = 250 y = Columns 1 through 30 1 10 100 15 150 121 28 83 42 26 63 39 193 157 191 137 188 107 85 62 29 93 142 41 16 160 24 43 36 163 Columns 31 through 40 54 146 81 22 23 33 133 148 101 25 a = 53 x = 1×0 empty double row vector b = 530 y = Columns 1 through 30 1 10 100 15 150 121 28 83 42 26 63 39 193 157 191 137 188 107 85 62 29 93 142 41 16 160 24 43 36 163 Columns 31 through 41 54 146 81 22 23 33 133 148 101 25 53 a = 136 x = 1×0 empty double row vector b = 1360 y = Columns 1 through 30 1 10 100 15 150 121 28 83 42 26 63 39 193 157 191 137 188 107 85 62 29 93 142 41 16 160 24 43 36 163 Columns 31 through 42 54 146 81 22 23 33 133 148 101 25 53 136 a = 178 x = 1×0 empty double row vector b = 1780 y = Columns 1 through 30 1 10 100 15 150 121 28 83 42 26 63 39 193 157 191 137 188 107 85 62 29 93 142 41 16 160 24 43 36 163 Columns 31 through 43 54 146 81 22 23 33 133 148 101 25 53 136 178 a = 7 x = 1×0 empty double row vector b = 70 y = Columns 1 through 30 1 10 100 15 150 121 28 83 42 26 63 39 193 157 191 137 188 107 85 62 29 93 142 41 16 160 24 43 36 163 Columns 31 through 44 54 146 81 22 23 33 133 148 101 25 53 136 178 7 a = 70 x = 1×0 empty double row vector b = 700 y = Columns 1 ...

14   Pass
x = 1977; y_correct = 658; assert(isequal(recurring_cycle(x),y_correct))

a = 1 x = [] b = 10 y = 1 a = 10 x = [] b = 100 y = 1 10 a = 100 x = 1×0 empty double row vector b = 1000 y = 1 10 100 a = 1000 x = 1×0 empty double row vector b = 10000 y = 1 10 100 1000 a = 115 x = 1×0 empty double row vector b = 1150 y = 1 10 100 1000 115 a = 1150 x = 1×0 empty double row vector b = 11500 y = 1 10 100 1000 115 1150 a = 1615 x = 1×0 empty double row vector b = 16150 y = 1 10 100 1000 115 1150 1615 a = 334 x = 1×0 empty double row vector b = 3340 y = 1 10 100 1000 115 1150 1615 334 a = 1363 x = 1×0 empty double row vector b = 13630 y = 1 10 100 1000 115 1150 1615 334 1363 a = 1768 x = 1×0 empty double row vector b = 17680 y = 1 10 100 1000 115 1150 1615 334 1363 1768 a = 1864 x = 1×0 empty double row vector b = 18640 y = 1 10 100 1000 115 1150 1615 334 1363 1768 1864 a = 847 x = 1×0 empty double row vector b = 8470 y = 1 10 100 1000 115 1150 1615 334 1363 1768 1864 847 a = 562 x = 1×0 empty double row vector b = 5620 y = 1 10 100 1000 115 1150 1615 334 1363 1768 1864 847 562 a = 1666 x = 1×0 empty double row vector b = 16660 y = 1 10 100 1000 115 1150 1615 334 1363 1768 1864 847 562 1666 a = 844 x = 1×0 empty double row vector b = 8440 y = 1 10 100 1000 115 1150 1615 334 1363 1768 1864 847 562 1666 844 a = 532 x = 1×0 empty double row vector b = 5320 y = Columns 1 through 15 1 10 100 1000 115 1150 1615 334 1363 1768 1864 847 562 1666 844 Column 16 532 a = 1366 x = 1×0 empty double row vector b = 13660 y = Columns 1 through 15 1 10 100 1000 115 1150 1615 334 1363 1768 1864 847 562 1666 844 Columns 16 through 17 532 1366 a = 1798 x = 1×0 empty double row vector b = 17980 y = Columns 1 through 15 1 10 100 1000 115 1150 1615 334 1363 1768 1864 847 562 1666 844 Columns 16 through 18 532 1366 1798 a = 187 x = 1×0 empty double row vector b = 1870 y = Columns 1 through 15 1 10 100 1000 115 1150 1615 334 1363 1768 1864 847 562 1666 844 Columns 16 through 19 532 1366 1798 187 a = 1870 x = 1×0 empty double row vector b = 18700 y = Columns 1 through 15 1 10 100 1000 115 1150 1615 334 1363 1768 1864 847 562 1666 844 Columns 16 through 20 532 1366 1798 187 1870 a = 907 x = 1×0 empty double row vector b = 9070 y = Columns 1 through 15 1 10 100 1000 115 1150 1615 334 1363 1768 1864 847 562 1666 844 Columns 16 through 21 532 1366 1798 187 1870 907 a = 1162 x = 1×0 empty double row vector b = 11620 y = Columns 1 through 15 1 10 100 1000 115 1150 1615 334 1363 1768 1864 847 562 1666 844 Columns 16 through 22 532 1366 1798 187 1870 907 1162 a = 1735 x = 1×0 empty double row vector b = 17350 y = Columns 1 through 15 1 10 100 1000 115 1150 1615 334 1363 1768 1864 847 562 1666 844 Columns 16 through 23 532 1366 1798 187 1870 907 1162 1735 a = 1534 x = 1×0 empty double row vector b = 15340 y = Columns 1 through 15 1 10 100 1000 115 1150 1615 334 1363 1768 1864 847 562 1666 844 Columns 16 through 24 532 1366 1798 187 1870 907 1162 1735 1534 a = 1501 x = 1×0 empty double row vector b = 15010 y = Columns 1 through 15 1 10 100 1000 115 1150 1615 334 1363 1768 1864 847 562 1666 844 Columns 16 through 25 532 1366 1798 187 1870 907 1162 1735 1534 1501 a = 1171 x = 1×0 empty double row vector b = 11710 y = Columns 1 through 15 1 10 100 1000 115 1150 1615 334 1363 1768 1864 847 562 1666 844 Columns 16 through 26 532 1366 1798 187 1870 907 1162 1735 1534 1501 1171 a = 1825 x = 1×0 empty double row vector b = 18250 y = Columns 1 through 15 1 10 100 1000 115 1150 1615 334 1363 1768 1864 847 562 1666 844 Columns 16 through 27 532 1366 1798 187 1870 907 1162 1735 1534 1501 1171 1825 a = 457 x = 1×0 empty double row vector b = 4570 y = Columns 1 through 15 1 10 100 1000 115 1150 1615 334 1363 1768 1864 847 562 1666 844 Columns 16 through 28 532 1366 1798 187 1870 907 1162 1735 1534 1501 1171 1825 457 a = 616 x = 1×0 empty double row vector b = 6160 y = Columns 1 through 15 1 10 100 1000 115 1150 1615 334 1363 1768 1864 847 562 1666 844 Columns 16 through 29 532 1366 1798 187 1870 907 1162 1735 1534 1501 1171 1825 457 616 a = 229 x = 1×0 empty double row vector b = 2290 y = Columns 1 through 15 1 10 100 1000 115 1150 1615 334 1363 1768 1864 847 562 1666 844 Columns 16 through 30 532 1366 1798 187 1870 907 1162 1735 1534 1501 1171 1825 457 616 229 a = 313 x = 1×0 empty double row vector b = 3130 y = Columns 1 through 15 1 10 100 1000 115 1150 1615 334 1363 1768 1864 847 562 1666 844 Columns 16 through 30 532 1366 1798 187 1870 907 1162 1735 1534 1501 1171 1825 457 616 229 Column 31 313 a = 1153 x = 1×0 empty double row vector b = 11530 y = Columns 1 through 15 1 10 100 1000 115 1150 1615 334 1363 1768 1864 847 562 1666 844 Columns 16 through 30 532 1366 1798 187 1870 907 1162 1735 1534 1501 1171 1825 457 616 229 Columns 31 through 32 313 1153 a = 1645 x = 1×0 empty double row vector b = 16450 y = Columns 1 through 15 1 10 100 1000 115 1150 1615 334 1363 1768 ...

15   Pass
x = 12345; y_correct = 822; assert(isequal(recurring_cycle(x),y_correct))

a = 1 x = [] b = 10 y = 1 a = 10 x = [] b = 100 y = 1 10 a = 100 x = 1×0 empty double row vector b = 1000 y = 1 10 100 a = 1000 x = 1×0 empty double row vector b = 10000 y = 1 10 100 1000 a = 10000 x = 1×0 empty double row vector b = 100000 y = 1 10 100 1000 10000 a = 1240 x = 1×0 empty double row vector b = 12400 y = 1 10 100 1000 10000 1240 a = 55 x = 1×0 empty double row vector b = 550 y = 1 10 100 1000 10000 1240 55 a = 550 x = 1×0 empty double row vector b = 5500 y = 1 10 100 1000 10000 1240 55 550 a = 5500 x = 1×0 empty double row vector b = 55000 y = 1 10 100 1000 10000 1240 55 550 5500 a = 5620 x = 1×0 empty double row vector b = 56200 y = 1 10 100 1000 10000 1240 55 550 5500 5620 a = 6820 x = 1×0 empty double row vector b = 68200 y = 1 10 100 1000 10000 1240 55 550 5500 5620 6820 a = 6475 x = 1×0 empty double row vector b = 64750 y = 1 10 100 1000 10000 1240 55 550 5500 5620 6820 6475 a = 3025 x = 1×0 empty double row vector b = 30250 y = 1 10 100 1000 10000 1240 55 550 5500 5620 6820 6475 3025 a = 5560 x = 1×0 empty double row vector b = 55600 y = 1 10 100 1000 10000 1240 55 550 5500 5620 6820 6475 3025 5560 a = 6220 x = 1×0 empty double row vector b = 62200 y = 1 10 100 1000 10000 1240 55 550 5500 5620 6820 6475 3025 5560 6220 a = 475 x = 1×0 empty double row vector b = 4750 y = Columns 1 through 15 1 10 100 1000 10000 1240 55 550 5500 5620 6820 6475 3025 5560 6220 Column 16 475 a = 4750 x = 1×0 empty double row vector b = 47500 y = Columns 1 through 15 1 10 100 1000 10000 1240 55 550 5500 5620 6820 6475 3025 5560 6220 Columns 16 through 17 475 4750 a = 10465 x = 1×0 empty double row vector b = 104650 y = Columns 1 through 15 1 10 100 1000 10000 1240 55 550 5500 5620 6820 6475 3025 5560 6220 Columns 16 through 18 475 4750 10465 a = 5890 x = 1×0 empty double row vector b = 58900 y = Columns 1 through 15 1 10 100 1000 10000 1240 55 550 5500 5620 6820 6475 3025 5560 6220 Columns 16 through 19 475 4750 10465 5890 a = 9520 x = 1×0 empty double row vector b = 95200 y = Columns 1 through 15 1 10 100 1000 10000 1240 55 550 5500 5620 6820 6475 3025 5560 6220 Columns 16 through 20 475 4750 10465 5890 9520 a = 8785 x = 1×0 empty double row vector b = 87850 y = Columns 1 through 15 1 10 100 1000 10000 1240 55 550 5500 5620 6820 6475 3025 5560 6220 Columns 16 through 21 475 4750 10465 5890 9520 8785 a = 1435 x = 1×0 empty double row vector b = 14350 y = Columns 1 through 15 1 10 100 1000 10000 1240 55 550 5500 5620 6820 6475 3025 5560 6220 Columns 16 through 22 475 4750 10465 5890 9520 8785 1435 a = 2005 x = 1×0 empty double row vector b = 20050 y = Columns 1 through 15 1 10 100 1000 10000 1240 55 550 5500 5620 6820 6475 3025 5560 6220 Columns 16 through 23 475 4750 10465 5890 9520 8785 1435 2005 a = 7705 x = 1×0 empty double row vector b = 77050 y = Columns 1 through 15 1 10 100 1000 10000 1240 55 550 5500 5620 6820 6475 3025 5560 6220 Columns 16 through 24 475 4750 10465 5890 9520 8785 1435 2005 7705 a = 2980 x = 1×0 empty double row vector b = 29800 y = Columns 1 through 15 1 10 100 1000 10000 1240 55 550 5500 5620 6820 6475 3025 5560 6220 Columns 16 through 25 475 4750 10465 5890 9520 8785 1435 2005 7705 2980 a = 5110 x = 1×0 empty double row vector b = 51100 y = Columns 1 through 15 1 10 100 1000 10000 1240 55 550 5500 5620 6820 6475 3025 5560 6220 Columns 16 through 26 475 4750 10465 5890 9520 8785 1435 2005 7705 2980 5110 a = 1720 x = 1×0 empty double row vector b = 17200 y = Columns 1 through 15 1 10 100 1000 10000 1240 55 550 5500 5620 6820 6475 3025 5560 6220 Columns 16 through 27 475 4750 10465 5890 9520 8785 1435 2005 7705 2980 5110 1720 a = 4855 x = 1×0 empty double row vector b = 48550 y = Columns 1 through 15 1 10 100 1000 10000 1240 55 550 5500 5620 6820 6475 3025 5560 6220 Columns 16 through 28 475 4750 10465 5890 9520 8785 1435 2005 7705 2980 5110 1720 4855 a = 11515 x = 1×0 empty double row vector b = 115150 y = Columns 1 through 15 1 10 100 1000 10000 1240 55 550 5500 5620 6820 6475 3025 5560 6220 Columns 16 through 29 475 4750 10465 5890 9520 8785 1435 2005 7705 2980 5110 1720 4855 11515 a = 4045 x = 1×0 empty double row vector b = 40450 y = Columns 1 through 15 1 10 100 1000 10000 1240 55 550 5500 5620 6820 6475 3025 5560 6220 Columns 16 through 30 475 4750 10465 5890 9520 8785 1435 2005 7705 2980 5110 1720 4855 11515 4045 a = 3415 x = 1×0 empty double row vector b = 34150 y = Columns 1 through 15 1 10 100 1000 10000 1240 55 550 5500 5620 6820 6475 3025 5560 6220 Columns 16 through 30 475 4750 10465 5890 9520 8785 1435 2005 7705 2980 5110 1720 4855 11515 4045 Column 31 3415 a = 9460 x = 1×0 empty double row vector b = 94600 y = Columns 1 through 15 1 10 100 1000 10000 1240 55 550 5500 5620 6820 6475 3025 5560 6220 Columns 16 through 30 475 4750 10465 5890 9520 8785 1435 2005 7705 2980 5110 1720 4855 11515 4045 Columns 31 through 32 3415 9460 a = 8185 x = 1×0 empty double row vector b = 81850 y = Columns 1 through 15 1 10 100 1000 10000 1240 ...