Cody

Solution 1302463

Submitted on 19 Oct 2017 by Daniel Meier
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(Recaman(x),y_correct))

y = 0

2   Pass
x = 5; y_correct = [0 1 3 6 2]; assert(isequal(Recaman(x),y_correct))

y = 0 1 3 6 2

3   Pass
x = 8; y_correct = [0 1 3 6 2 7 13 20]; assert(isequal(Recaman(x),y_correct))

y = 0 1 3 6 2 7 13 20

4   Pass
x = 10; y_correct = [0 1 3 6 2 7 13 20 12 21]; assert(isequal(Recaman(x),y_correct))

y = 0 1 3 6 2 7 13 20 12 21

5   Pass
x = 5e4; y = Recaman(x); assert(isequal(length(Recaman(x)),x)) assert(isequal(y(954),739)) assert(isequal(y(7589),17654)) assert(isequal(y(12345),18554))

y = Columns 1 through 15 0 1 3 6 2 7 13 20 12 21 11 22 10 23 9 Columns 16 through 30 24 8 25 43 62 42 63 41 18 42 17 43 16 44 15 Columns 31 through 45 45 14 46 79 113 78 114 77 39 78 38 79 37 80 36 Columns 46 through 60 81 35 82 34 83 33 84 32 85 31 86 30 87 29 88 Columns 61 through 75 28 89 27 90 26 91 157 224 156 225 155 226 154 227 153 Columns 76 through 90 228 152 75 153 74 154 73 155 72 156 71 157 70 158 69 Columns 91 through 105 159 68 160 67 161 66 162 65 163 64 164 265 367 264 368 Columns 106 through 120 263 369 262 370 261 151 40 152 265 379 494 378 495 377 258 Columns 121 through 135 138 259 137 260 136 261 135 262 134 5 135 4 136 269 403 Columns 136 through 150 268 132 269 131 270 130 271 129 272 128 273 127 274 126 275 Columns 151 through 165 125 276 124 277 123 278 122 279 121 280 120 281 119 282 118 Columns 166 through 180 283 117 284 116 285 115 286 458 631 457 632 456 633 455 634 Columns 181 through 195 454 635 453 636 452 267 453 266 454 643 833 642 450 257 451 Columns 196 through 210 256 60 257 59 258 58 259 57 260 56 261 55 262 54 263 Columns 211 through 225 53 264 52 265 51 266 50 267 49 268 48 269 47 270 494 Columns 226 through 240 719 493 720 492 721 491 722 490 723 489 254 490 253 491 252 Columns 241 through 255 492 251 493 250 494 249 495 248 496 247 497 246 498 245 499 Columns 256 through 270 244 500 243 501 242 502 241 503 240 504 239 505 238 506 237 Columns 271 through 285 507 236 508 235 509 234 510 233 511 232 512 231 513 230 514 Columns 286 through 300 229 515 802 1090 801 1091 800 1092 799 1093 798 1094 797 1095 796 Columns 301 through 315 1096 795 1097 794 1098 793 487 180 488 179 489 178 490 177 491 Columns 316 through 330 176 492 175 493 174 494 173 495 172 496 171 497 170 498 169 Columns 331 through 345 499 168 500 167 501 166 502 165 503 842 1182 841 1183 840 1184 Columns 346 through 360 839 1185 838 1186 837 1187 836 484 837 483 838 482 839 481 840 Columns 361 through 375 480 841 479 842 478 843 477 110 478 109 479 108 480 107 481 Columns 376 through 390 106 482 105 483 104 484 103 485 102 486 101 487 100 488 99 Columns 391 through 405 489 98 490 97 491 96 492 95 493 94 494 93 495 92 496 Columns 406 through 420 901 1307 900 1308 899 1309 898 1310 897 1311 896 1312 895 1313 894 Columns 421 through 435 474 895 473 896 472 897 471 898 470 899 469 900 468 901 467 Columns 436 through 450 902 466 903 465 904 464 905 463 906 462 907 461 908 460 909 Columns 451 through 465 459 910 1362 1815 1361 1816 1360 1817 1359 1818 1358 1819 1357 1820 1356 Columns 466 through 480 891 425 892 424 893 423 894 422 895 421 896 420 897 419 898 Columns 481 through 495 418 899 417 900 416 901 415 902 414 903 413 904 412 905 411 Columns 496 through 510 906 410 907 409 908 408 909 407 910 406 911 405 912 404 913 Columns 511 through 525 1423 1934 1422 1935 1421 1936 1420 1937 1419 1938 1418 1939 1417 1940 1416 Columns 526 through 540 1941 1415 888 360 889 359 890 358 891 357 892 356 893 355 894 Columns 541 through 555 354 895 353 896 352 897 351 898 350 899 349 900 348 901 347 Columns 556 through 570 902 346 903 345 904 344 905 343 906 342 907 341 908 340 909 Columns 571 through 585 339 910 338 911 337 912 336 913 335 914 334 915 333 916 332 Columns 586 through 600 917 331 918 330 919 329 920 328 921 327 922 326 923 325 924 Columns 601 through 615 324 925 323 926 322 927 321 928 320 929 319 930 318 931 317 Columns 616 through 630 932 316 933 315 934 314 935 313 936 312 937 311 938 310 939 Columns 631 through 645 309 940 308 941 307 942 306 943 305 944 304 945 303 946 302 Columns 646 through 660 947 301 948 300 949 299 950 298 951 297 952 296 953 295 954 Columns 661 through 675 294 955 293 956 292 957 291 958 290 959 289 960 288 961 287 Columns 676 through 690 962 1638 2315 1637 2316 1636 2317 1635 2318 1634 2319 1633 2320 1632 2321 Columns 691 through 705 1631 2322 1630 2323 1629 2324 1628 2325 1627 2326 1626 2327 1625 2328 1624 Columns 706 through 720 2329 1623 2330 1622 2331 1621 2332 1620 2333 1619 2334 1618 2335 ...

6   Pass
x = 1e5; y = Recaman(x); assert(isequal(length(Recaman(x)),x)) assert(isequal(y(1e4),8658)) assert(isequal(y(2e4),34358)) assert(isequal(y(3e4),92474)) assert(isequal(y(4e4),102344))

y = Columns 1 through 15 0 1 3 6 2 7 13 20 12 21 11 22 10 23 9 Columns 16 through 30 24 8 25 43 62 42 63 41 18 42 17 43 16 44 15 Columns 31 through 45 45 14 46 79 113 78 114 77 39 78 38 79 37 80 36 Columns 46 through 60 81 35 82 34 83 33 84 32 85 31 86 30 87 29 88 Columns 61 through 75 28 89 27 90 26 91 157 224 156 225 155 226 154 227 153 Columns 76 through 90 228 152 75 153 74 154 73 155 72 156 71 157 70 158 69 Columns 91 through 105 159 68 160 67 161 66 162 65 163 64 164 265 367 264 368 Columns 106 through 120 263 369 262 370 261 151 40 152 265 379 494 378 495 377 258 Columns 121 through 135 138 259 137 260 136 261 135 262 134 5 135 4 136 269 403 Columns 136 through 150 268 132 269 131 270 130 271 129 272 128 273 127 274 126 275 Columns 151 through 165 125 276 124 277 123 278 122 279 121 280 120 281 119 282 118 Columns 166 through 180 283 117 284 116 285 115 286 458 631 457 632 456 633 455 634 Columns 181 through 195 454 635 453 636 452 267 453 266 454 643 833 642 450 257 451 Columns 196 through 210 256 60 257 59 258 58 259 57 260 56 261 55 262 54 263 Columns 211 through 225 53 264 52 265 51 266 50 267 49 268 48 269 47 270 494 Columns 226 through 240 719 493 720 492 721 491 722 490 723 489 254 490 253 491 252 Columns 241 through 255 492 251 493 250 494 249 495 248 496 247 497 246 498 245 499 Columns 256 through 270 244 500 243 501 242 502 241 503 240 504 239 505 238 506 237 Columns 271 through 285 507 236 508 235 509 234 510 233 511 232 512 231 513 230 514 Columns 286 through 300 229 515 802 1090 801 1091 800 1092 799 1093 798 1094 797 1095 796 Columns 301 through 315 1096 795 1097 794 1098 793 487 180 488 179 489 178 490 177 491 Columns 316 through 330 176 492 175 493 174 494 173 495 172 496 171 497 170 498 169 Columns 331 through 345 499 168 500 167 501 166 502 165 503 842 1182 841 1183 840 1184 Columns 346 through 360 839 1185 838 1186 837 1187 836 484 837 483 838 482 839 481 840 Columns 361 through 375 480 841 479 842 478 843 477 110 478 109 479 108 480 107 481 Columns 376 through 390 106 482 105 483 104 484 103 485 102 486 101 487 100 488 99 Columns 391 through 405 489 98 490 97 491 96 492 95 493 94 494 93 495 92 496 Columns 406 through 420 901 1307 900 1308 899 1309 898 1310 897 1311 896 1312 895 1313 894 Columns 421 through 435 474 895 473 896 472 897 471 898 470 899 469 900 468 901 467 Columns 436 through 450 902 466 903 465 904 464 905 463 906 462 907 461 908 460 909 Columns 451 through 465 459 910 1362 1815 1361 1816 1360 1817 1359 1818 1358 1819 1357 1820 1356 Columns 466 through 480 891 425 892 424 893 423 894 422 895 421 896 420 897 419 898 Columns 481 through 495 418 899 417 900 416 901 415 902 414 903 413 904 412 905 411 Columns 496 through 510 906 410 907 409 908 408 909 407 910 406 911 405 912 404 913 Columns 511 through 525 1423 1934 1422 1935 1421 1936 1420 1937 1419 1938 1418 1939 1417 1940 1416 Columns 526 through 540 1941 1415 888 360 889 359 890 358 891 357 892 356 893 355 894 Columns 541 through 555 354 895 353 896 352 897 351 898 350 899 349 900 348 901 347 Columns 556 through 570 902 346 903 345 904 344 905 343 906 342 907 341 908 340 909 Columns 571 through 585 339 910 338 911 337 912 336 913 335 914 334 915 333 916 332 Columns 586 through 600 917 331 918 330 919 329 920 328 921 327 922 326 923 325 924 Columns 601 through 615 324 925 323 926 322 927 321 928 320 929 319 930 318 931 317 Columns 616 through 630 932 316 933 315 934 314 935 313 936 312 937 311 938 310 939 Columns 631 through 645 309 940 308 941 307 942 306 943 305 944 304 945 303 946 302 Columns 646 through 660 947 301 948 300 949 299 950 298 951 297 952 296 953 295 954 Columns 661 through 675 294 955 293 956 292 957 291 958 290 959 289 960 288 961 287 Columns 676 through 690 962 1638 2315 1637 2316 1636 2317 1635 2318 1634 2319 1633 2320 1632 2321 Columns 691 through 705 1631 2322 1630 2323 1629 2324 1628 2325 1627 2326 1626 2327 1625 2328 1624 Columns 706 through 720 2329 1623 2330 1622 2331 1621 2332 1620 2333 1619 2334 1618 2335 ...