Cody

Solution 1431807

Submitted on 2 Feb 2018 by Berkay Dogus
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
base=4;nstart=2;nend=6;y_correct=62; assert(isequal(sum_distinct_powers(base,nstart,nend),y_correct))

a = 1 a = 1 4 a = 1 4 5 a = 1 4 5 16 a = 1 4 5 16 17 a = 1 4 5 16 17 20

2   Pass
base=5;nstart=1;nend=1000;y_correct=1193853250; assert(isequal(sum_distinct_powers(base,nstart,nend),y_correct))

a = 1 a = 1 5 a = 1 5 6 a = 1 5 6 25 a = 1 5 6 25 26 a = 1 5 6 25 26 30 a = 1 5 6 25 26 30 31 a = 1 5 6 25 26 30 31 125 a = 1 5 6 25 26 30 31 125 126 a = 1 5 6 25 26 30 31 125 126 130 a = 1 5 6 25 26 30 31 125 126 130 131 a = 1 5 6 25 26 30 31 125 126 130 131 150 a = 1 5 6 25 26 30 31 125 126 130 131 150 151 a = 1 5 6 25 26 30 31 125 126 130 131 150 151 155 a = 1 5 6 25 26 30 31 125 126 130 131 150 151 155 156 a = 1 5 6 25 26 30 31 125 126 130 131 150 151 155 156 625 a = 1 5 6 25 26 30 31 125 126 130 131 150 151 155 156 625 626 a = 1 5 6 25 26 30 31 125 126 130 131 150 151 155 156 625 626 630 a = 1 5 6 25 26 30 31 125 126 130 131 150 151 155 156 625 626 630 631 a = 1 5 6 25 26 30 31 125 126 130 131 150 151 155 156 625 626 630 631 650 a = 1 5 6 25 26 30 31 125 126 130 131 150 151 155 156 625 626 630 631 650 651 a = 1 5 6 25 26 30 31 125 126 130 131 150 151 155 156 625 626 630 631 650 651 655 a = 1 5 6 25 26 30 31 125 126 130 131 150 151 155 156 625 626 630 631 650 651 655 656 a = 1 5 6 25 26 30 31 125 126 130 131 150 151 155 156 625 626 630 631 650 651 655 656 750 a = 1 5 6 25 26 30 31 125 126 130 131 150 151 155 156 625 626 630 631 650 651 655 656 750 751 a = 1 5 6 25 26 30 31 125 126 130 131 150 151 155 156 625 626 630 631 650 651 655 656 750 751 755 a = 1 5 6 25 26 30 31 125 126 130 131 150 151 155 156 625 626 630 631 650 651 655 656 750 751 755 756 a = 1 5 6 25 26 30 31 125 126 130 131 150 151 155 156 625 626 630 631 650 651 655 656 750 751 755 756 775 a = 1 5 6 25 26 30 31 125 126 130 131 150 151 155 156 625 626 630 631 650 651 655 656 750 751 755 756 775 776 a = Columns 1 through 29 1 5 6 25 26 30 31 125 126 130 131 150 151 155 156 625 626 630 631 650 651 655 656 750 751 755 756 775 776 Column 30 780 a = Columns 1 through 29 1 5 6 25 26 30 31 125 126 130 131 150 151 155 156 625 626 630 631 650 651 655 656 750 751 755 756 775 776 Columns 30 through 31 780 781 a = Columns 1 through 14 1 5 6 25 26 30 31 125 126 130 131 150 151 155 Columns 15 through 28 156 625 626 630 631 650 651 655 656 750 751 755 756 775 Columns 29 through 32 776 780 781 3125 a = Columns 1 through 14 1 5 6 25 26 30 31 125 126 130 131 150 151 155 Columns 15 through 28 156 625 626 630 631 650 651 655 656 750 751 755 756 775 Columns 29 through 33 776 780 781 3125 3126 a = Columns 1 through 14 1 5 6 25 26 30 31 125 126 130 131 150 151 155 Columns 15 through 28 156 625 626 630 631 650 651 655 656 750 751 755 756 775 Columns 29 through 34 776 780 781 3125 3126 3130 a = Columns 1 through 14 1 5 6 25 26 30 31 125 126 130 131 150 151 155 Columns 15 through 28 156 625 626 630 631 650 651 655 656 750 751 755 756 775 Columns 29 through 35 776 780 781 3125 3126 3130 3131 a = Columns 1 through 14 1 5 6 25 26 30 31 125 126 130 131 150 151 155 Columns 15 through 28 156 625 626 630 631 650 651 655 656 750 751 755 756 775 Columns 29 through 36 776 780 781 3125 3126 3130 3131 3150 a = Columns 1 through 14 1 5 6 25 26 30 31 125 126 130 131 150 151 155 Columns 15 through 28 156 625 626 630 631 650 651 655 656 750 751 755 756 775 Columns 29 through 37 776 780 781 3125 3126 3130 3131 3150 3151 a = Columns 1 through 14 1 5 6 25 26 30 31 125 126 130 131 150 151 155 Columns 15 through 28 156 625 626 630 631 650 651 655 656 750 751 755 756 775 Columns 29 through 38 776 780 781 3125 3126 3130 3131 3150 3151 3155 a = Columns 1 through 14 1 5 6 25 26 30 31 125 126 130 131 150 151 155 Columns 15 through 28 156 625 626 630 631 650 651 655 656 750 751 755 756 775 Columns 29 through 39 776 780 781 3125 3126 3130 3131 3150 3151 3155 3156 a = Columns 1 through 14 1 5 6 25 26 30 31 125 126 130 131 150 151 155 Columns 15 through 28 156 625 626 630 631 650 651 655 656 750 751 755 756 775 Columns 29 through 40 776 780 781 3125 3126 3130 3131 3150 3151 3155 3156 3250 a = Columns 1 through 14 1 5 6 25 26 30 31 125 126 130 131 150 151 155 Columns 15 through 28 156 625 626 630 631 650 651 655 656 750 751 755 756 775 Columns 29 through 41 776 780 781 3125 3126 3130 3131 3150 3151 3155 3156 3250 3251 a = Columns 1 through 14 1 5 6 25 26 30 31 125 126 130 131 150 151 155 Columns 15 through 28 156 625 626 630 631 650 651 655 656 750 751 755 756 775 Columns 29 through 42 776 780 781 3125 3126 3130 3131 3150 3151 3155 3156 3250 3251 3255 a = Columns 1 through 14 1 5 6 25 26 30 31 125 126 130 131 150 151 155 Columns 15 through 28 156 625 626 630 631 650 651 655 656 750 751 755 756 775 Columns 29 through 42 776 780 781 3125 3126 3130 3131 3150 3151 3155 3156 3250 3251 3255 Column 43 3256 a = Columns 1 through 14 1 5 6 25 26 30 31 125 126 130 131 150 151 155 Columns 15 through 28 156 ...

3   Pass
base=3;nstart=1;nend=1000;y_correct=14438162; assert(isequal(sum_distinct_powers(base,nstart,nend),y_correct))

a = 1 a = 1 3 a = 1 3 4 a = 1 3 4 9 a = 1 3 4 9 10 a = 1 3 4 9 10 12 a = 1 3 4 9 10 12 13 a = 1 3 4 9 10 12 13 27 a = 1 3 4 9 10 12 13 27 28 a = 1 3 4 9 10 12 13 27 28 30 a = 1 3 4 9 10 12 13 27 28 30 31 a = 1 3 4 9 10 12 13 27 28 30 31 36 a = 1 3 4 9 10 12 13 27 28 30 31 36 37 a = 1 3 4 9 10 12 13 27 28 30 31 36 37 39 a = 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 a = 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 a = 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 a = 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 a = 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 a = 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 a = 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 a = 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 a = 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 a = 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 a = 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 a = 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 a = 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 a = 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 a = 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Column 30 120 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 31 120 121 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 32 120 121 243 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 33 120 121 243 244 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 34 120 121 243 244 246 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 35 120 121 243 244 246 247 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 36 120 121 243 244 246 247 252 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 37 120 121 243 244 246 247 252 253 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 38 120 121 243 244 246 247 252 253 255 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 39 120 121 243 244 246 247 252 253 255 256 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 40 120 121 243 244 246 247 252 253 255 256 270 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 41 120 121 243 244 246 247 252 253 255 256 270 271 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 42 120 121 243 244 246 247 252 253 255 256 270 271 273 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 43 120 121 243 244 246 247 252 253 255 256 270 271 273 274 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 44 120 121 243 244 246 247 252 253 255 256 270 271 273 274 279 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 45 120 121 243 244 246 247 252 253 255 256 270 271 273 274 279 280 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 46 120 121 243 244 246 247 252 253 255 256 270 271 273 274 279 280 282 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 47 120 121 243 244 246 247 252 253 255 256 270 271 273 274 279 280 282 283 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 48 120 121 243 244 246 247 252 253 255 256 270 271 273 274 279 280 282 283 324 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 49 120 121 243 244 246 247 252 253 255 256 270 271 273 274 279 280 282 283 324 325 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 50 120 121 243 244 246 247 252 253 255 256 270 271 273 274 279 280 282 283 324 325 327 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 51 120 121 243 244 246 247 252 253 255 256 270 271 273 274 279 280 282 283 324 325 327 328 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 52 120 121 243 244 246 247 252 253 255 256 270 271 273 274 279 280 282 283 324 325 327 328 333 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91...

4   Pass
base=3;nstart=100;nend=1000;y_correct=14397354; assert(isequal(sum_distinct_powers(base,nstart,nend),y_correct))

a = 1 a = 1 3 a = 1 3 4 a = 1 3 4 9 a = 1 3 4 9 10 a = 1 3 4 9 10 12 a = 1 3 4 9 10 12 13 a = 1 3 4 9 10 12 13 27 a = 1 3 4 9 10 12 13 27 28 a = 1 3 4 9 10 12 13 27 28 30 a = 1 3 4 9 10 12 13 27 28 30 31 a = 1 3 4 9 10 12 13 27 28 30 31 36 a = 1 3 4 9 10 12 13 27 28 30 31 36 37 a = 1 3 4 9 10 12 13 27 28 30 31 36 37 39 a = 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 a = 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 a = 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 a = 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 a = 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 a = 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 a = 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 a = 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 a = 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 a = 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 a = 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 a = 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 a = 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 a = 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 a = 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Column 30 120 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 31 120 121 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 32 120 121 243 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 33 120 121 243 244 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 34 120 121 243 244 246 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 35 120 121 243 244 246 247 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 36 120 121 243 244 246 247 252 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 37 120 121 243 244 246 247 252 253 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 38 120 121 243 244 246 247 252 253 255 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 39 120 121 243 244 246 247 252 253 255 256 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 40 120 121 243 244 246 247 252 253 255 256 270 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 41 120 121 243 244 246 247 252 253 255 256 270 271 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 42 120 121 243 244 246 247 252 253 255 256 270 271 273 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 43 120 121 243 244 246 247 252 253 255 256 270 271 273 274 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 44 120 121 243 244 246 247 252 253 255 256 270 271 273 274 279 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 45 120 121 243 244 246 247 252 253 255 256 270 271 273 274 279 280 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 46 120 121 243 244 246 247 252 253 255 256 270 271 273 274 279 280 282 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 47 120 121 243 244 246 247 252 253 255 256 270 271 273 274 279 280 282 283 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 48 120 121 243 244 246 247 252 253 255 256 270 271 273 274 279 280 282 283 324 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 49 120 121 243 244 246 247 252 253 255 256 270 271 273 274 279 280 282 283 324 325 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 50 120 121 243 244 246 247 252 253 255 256 270 271 273 274 279 280 282 283 324 325 327 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 51 120 121 243 244 246 247 252 253 255 256 270 271 273 274 279 280 282 283 324 325 327 328 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91 93 94 108 109 111 112 117 118 Columns 30 through 52 120 121 243 244 246 247 252 253 255 256 270 271 273 274 279 280 282 283 324 325 327 328 333 a = Columns 1 through 29 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 81 82 84 85 90 91...

5   Pass
base=2;nstart=1;nend=2017;y_correct=2035153; assert(isequal(sum_distinct_powers(base,nstart,nend),y_correct))

a = 1 a = 1 2 a = 1 2 3 a = 1 2 3 4 a = 1 2 3 4 5 a = 1 2 3 4 5 6 a = 1 2 3 4 5 6 7 a = 1 2 3 4 5 6 7 8 a = 1 2 3 4 5 6 7 8 9 a = 1 2 3 4 5 6 7 8 9 10 a = 1 2 3 4 5 6 7 8 9 10 11 a = 1 2 3 4 5 6 7 8 9 10 11 12 a = 1 2 3 4 5 6 7 8 9 10 11 12 13 a = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 a = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 a = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 a = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 a = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 a = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 a = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 a = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 a = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 a = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 a = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 a = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 a = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 a = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 a = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 a = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Column 30 30 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 31 30 31 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 32 30 31 32 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 33 30 31 32 33 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 34 30 31 32 33 34 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 35 30 31 32 33 34 35 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 36 30 31 32 33 34 35 36 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 37 30 31 32 33 34 35 36 37 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 38 30 31 32 33 34 35 36 37 38 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 39 30 31 32 33 34 35 36 37 38 39 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 40 30 31 32 33 34 35 36 37 38 39 40 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 41 30 31 32 33 34 35 36 37 38 39 40 41 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 42 30 31 32 33 34 35 36 37 38 39 40 41 42 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 43 30 31 32 33 34 35 36 37 38 39 40 41 42 43 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 44 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 45 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 46 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 47 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 48 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 49 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 50 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 51 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 52 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21...

6   Pass
base=7;nstart=1234;nend=2345;y_correct=843569026324; assert(isequal(sum_distinct_powers(base,nstart,nend),y_correct))

a = 1 a = 1 7 a = 1 7 8 a = 1 7 8 49 a = 1 7 8 49 50 a = 1 7 8 49 50 56 a = 1 7 8 49 50 56 57 a = 1 7 8 49 50 56 57 343 a = 1 7 8 49 50 56 57 343 344 a = 1 7 8 49 50 56 57 343 344 350 a = 1 7 8 49 50 56 57 343 344 350 351 a = 1 7 8 49 50 56 57 343 344 350 351 392 a = 1 7 8 49 50 56 57 343 344 350 351 392 393 a = 1 7 8 49 50 56 57 343 344 350 351 392 393 399 a = 1 7 8 49 50 56 57 343 344 350 351 392 393 399 400 a = Columns 1 through 14 1 7 8 49 50 56 57 343 344 350 351 392 393 399 Columns 15 through 16 400 2401 a = Columns 1 through 14 1 7 8 49 50 56 57 343 344 350 351 392 393 399 Columns 15 through 17 400 2401 2402 a = Columns 1 through 14 1 7 8 49 50 56 57 343 344 350 351 392 393 399 Columns 15 through 18 400 2401 2402 2408 a = Columns 1 through 14 1 7 8 49 50 56 57 343 344 350 351 392 393 399 Columns 15 through 19 400 2401 2402 2408 2409 a = Columns 1 through 14 1 7 8 49 50 56 57 343 344 350 351 392 393 399 Columns 15 through 20 400 2401 2402 2408 2409 2450 a = Columns 1 through 14 1 7 8 49 50 56 57 343 344 350 351 392 393 399 Columns 15 through 21 400 2401 2402 2408 2409 2450 2451 a = Columns 1 through 14 1 7 8 49 50 56 57 343 344 350 351 392 393 399 Columns 15 through 22 400 2401 2402 2408 2409 2450 2451 2457 a = Columns 1 through 14 1 7 8 49 50 56 57 343 344 350 351 392 393 399 Columns 15 through 23 400 2401 2402 2408 2409 2450 2451 2457 2458 a = Columns 1 through 14 1 7 8 49 50 56 57 343 344 350 351 392 393 399 Columns 15 through 24 400 2401 2402 2408 2409 2450 2451 2457 2458 2744 a = Columns 1 through 14 1 7 8 49 50 56 57 343 344 350 351 392 393 399 Columns 15 through 25 400 2401 2402 2408 2409 2450 2451 2457 2458 2744 2745 a = Columns 1 through 14 1 7 8 49 50 56 57 343 344 350 351 392 393 399 Columns 15 through 26 400 2401 2402 2408 2409 2450 2451 2457 2458 2744 2745 2751 a = Columns 1 through 14 1 7 8 49 50 56 57 343 344 350 351 392 393 399 Columns 15 through 27 400 2401 2402 2408 2409 2450 2451 2457 2458 2744 2745 2751 2752 a = Columns 1 through 14 1 7 8 49 50 56 57 343 344 350 351 392 393 399 Columns 15 through 28 400 2401 2402 2408 2409 2450 2451 2457 2458 2744 2745 2751 2752 2793 a = Columns 1 through 14 1 7 8 49 50 56 57 343 344 350 351 392 393 399 Columns 15 through 28 400 2401 2402 2408 2409 2450 2451 2457 2458 2744 2745 2751 2752 2793 Column 29 2794 a = Columns 1 through 14 1 7 8 49 50 56 57 343 344 350 351 392 393 399 Columns 15 through 28 400 2401 2402 2408 2409 2450 2451 2457 2458 2744 2745 2751 2752 2793 Columns 29 through 30 2794 2800 a = Columns 1 through 14 1 7 8 49 50 56 57 343 344 350 351 392 393 399 Columns 15 through 28 400 2401 2402 2408 2409 2450 2451 2457 2458 2744 2745 2751 2752 2793 Columns 29 through 31 2794 2800 2801 a = Columns 1 through 14 1 7 8 49 50 56 57 343 344 350 351 392 393 399 Columns 15 through 28 400 2401 2402 2408 2409 2450 2451 2457 2458 2744 2745 2751 2752 2793 Columns 29 through 32 2794 2800 2801 16807 a = Columns 1 through 14 1 7 8 49 50 56 57 343 344 350 351 392 393 399 Columns 15 through 28 400 2401 2402 2408 2409 2450 2451 2457 2458 2744 2745 2751 2752 2793 Columns 29 through 33 2794 2800 2801 16807 16808 a = Columns 1 through 14 1 7 8 49 50 56 57 343 344 350 351 392 393 399 Columns 15 through 28 400 2401 2402 2408 2409 2450 2451 2457 2458 2744 2745 2751 2752 2793 Columns 29 through 34 2794 2800 2801 16807 16808 16814 a = Columns 1 through 14 1 7 8 49 50 56 57 343 344 350 351 392 393 399 Columns 15 through 28 400 2401 2402 2408 2409 2450 2451 2457 2458 2744 2745 2751 2752 2793 Columns 29 through 35 2794 2800 2801 16807 16808 16814 16815 a = Columns 1 through 14 1 7 8 49 50 56 57 343 344 350 351 392 393 399 Columns 15 through 28 400 2401 2402 2408 2409 2450 2451 2457 2458 2744 2745 2751 2752 2793 Columns 29 through 36 2794 2800 2801 16807 16808 16814 16815 16856 a = Columns 1 through 14 1 7 8 49 50 56 57 343 344 350 351 392 393 399 Columns 15 through 28 400 2401 2402 2408 2409 2450 2451 2457 2458 2744 2745 2751 2752 2793 Columns 29 through 37 2794 2800 2801 16807 16808 16814 16815 16856 16857 a = Columns 1 through 14 1 7 8 49 50 56 57 343 344 350 351 392 393 399 Columns 15 through 28 400 2401 2402 2408 2409 2450 2451 2457 2458 2744 2745 2751 2752 2793 Columns 29 through 38 2794 2800 2801 16807 16808 16814 16815 16856 16857 16863 a = Columns 1 through 14 1 7 8 49 50 ...

7   Pass
base=7;nstart=1;nend=10;y_correct=1265; assert(isequal(sum_distinct_powers(base,nstart,nend),y_correct))

a = 1 a = 1 7 a = 1 7 8 a = 1 7 8 49 a = 1 7 8 49 50 a = 1 7 8 49 50 56 a = 1 7 8 49 50 56 57 a = 1 7 8 49 50 56 57 343 a = 1 7 8 49 50 56 57 343 344 a = 1 7 8 49 50 56 57 343 344 350

8   Pass
nstart=1;nend=50; junk=arrayfun(@(base) sum_distinct_powers(base,nstart,nend),2:10); y_correct=[1275 7120 26365 75000 178591 374560 714465 1266280 2116675]; assert(isequal(junk,y_correct))

a = 1 a = 1 2 a = 1 2 3 a = 1 2 3 4 a = 1 2 3 4 5 a = 1 2 3 4 5 6 a = 1 2 3 4 5 6 7 a = 1 2 3 4 5 6 7 8 a = 1 2 3 4 5 6 7 8 9 a = 1 2 3 4 5 6 7 8 9 10 a = 1 2 3 4 5 6 7 8 9 10 11 a = 1 2 3 4 5 6 7 8 9 10 11 12 a = 1 2 3 4 5 6 7 8 9 10 11 12 13 a = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 a = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 a = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 a = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 a = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 a = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 a = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 a = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 a = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 a = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 a = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 a = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 a = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 a = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 a = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 a = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Column 30 30 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 31 30 31 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 32 30 31 32 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 33 30 31 32 33 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 34 30 31 32 33 34 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 35 30 31 32 33 34 35 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 36 30 31 32 33 34 35 36 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 37 30 31 32 33 34 35 36 37 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 38 30 31 32 33 34 35 36 37 38 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 39 30 31 32 33 34 35 36 37 38 39 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 40 30 31 32 33 34 35 36 37 38 39 40 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 41 30 31 32 33 34 35 36 37 38 39 40 41 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 42 30 31 32 33 34 35 36 37 38 39 40 41 42 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 43 30 31 32 33 34 35 36 37 38 39 40 41 42 43 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 44 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 45 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 46 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 47 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 48 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 49 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 a = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 50 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 a = 1 a = 1 3 a = 1 3 4 a = 1 3 4 9 a = 1 3 4 9 10 a = 1 3 4 9 10 12 a = 1 3 4 9 10 12 13 a = 1 3 4 9 10 12 13 27 a = 1 3 4 9 10 12 13 27 28 a = 1 3 4 9 10 12 13 27 28 30 a = 1 3 4 9 10 12 13 27 28 30 31 a = 1 3 4 9 10 12 13 27 28 30 31 36 a = 1 3 4 9 10 12 13 27 28 30 31 36 37 a = 1 3 4 9 10 12 13 27 28 30 31 36 37 39 a = 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40 a = 1 3 4 9 10 12 13 ...

Suggested Problems

More from this Author80