Cody

Solution 1311109

Submitted on 23 Oct 2017 by Elmar Zander
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 = 0; y_correct = 2; assert(isequal(RecamanII(x),y_correct))

seq = 0 1 n = 2

2   Pass
x = 1; y_correct = 1; assert(isequal(RecamanII(x),y_correct))

seq = 1 n = 1

3   Pass
x = 3; y_correct = 4; assert(isequal(RecamanII(x),y_correct))

seq = 3 2 4 1 n = 4

4   Pass
x = 90; y_correct = 35; assert(isequal(RecamanII(x),y_correct))

seq = Columns 1 through 30 90 89 87 84 80 75 69 62 54 45 35 24 12 25 11 26 10 27 9 28 8 29 7 30 6 31 5 32 4 33 Columns 31 through 35 3 34 2 35 1 n = 35

5   Pass
x = 123456; y_correct = 895; assert(isequal(RecamanII(x),y_correct))

seq = Columns 1 through 15 123456 123455 123453 123450 123446 123441 123435 123428 123420 123411 123401 123390 123378 123365 123351 Columns 16 through 30 123336 123320 123303 123285 123266 123246 123225 123203 123180 123156 123131 123105 123078 123050 123021 Columns 31 through 45 122991 122960 122928 122895 122861 122826 122790 122753 122715 122676 122636 122595 122553 122510 122466 Columns 46 through 60 122421 122375 122328 122280 122231 122181 122130 122078 122025 121971 121916 121860 121803 121745 121686 Columns 61 through 75 121626 121565 121503 121440 121376 121311 121245 121178 121110 121041 120971 120900 120828 120755 120681 Columns 76 through 90 120606 120530 120453 120375 120296 120216 120135 120053 119970 119886 119801 119715 119628 119540 119451 Columns 91 through 105 119361 119270 119178 119085 118991 118896 118800 118703 118605 118506 118406 118305 118203 118100 117996 Columns 106 through 120 117891 117785 117678 117570 117461 117351 117240 117128 117015 116901 116786 116670 116553 116435 116316 Columns 121 through 135 116196 116075 115953 115830 115706 115581 115455 115328 115200 115071 114941 114810 114678 114545 114411 Columns 136 through 150 114276 114140 114003 113865 113726 113586 113445 113303 113160 113016 112871 112725 112578 112430 112281 Columns 151 through 165 112131 111980 111828 111675 111521 111366 111210 111053 110895 110736 110576 110415 110253 110090 109926 Columns 166 through 180 109761 109595 109428 109260 109091 108921 108750 108578 108405 108231 108056 107880 107703 107525 107346 Columns 181 through 195 107166 106985 106803 106620 106436 106251 106065 105878 105690 105501 105311 105120 104928 104735 104541 Columns 196 through 210 104346 104150 103953 103755 103556 103356 103155 102953 102750 102546 102341 102135 101928 101720 101511 Columns 211 through 225 101301 101090 100878 100665 100451 100236 100020 99803 99585 99366 99146 98925 98703 98480 98256 Columns 226 through 240 98031 97805 97578 97350 97121 96891 96660 96428 96195 95961 95726 95490 95253 95015 94776 Columns 241 through 255 94536 94295 94053 93810 93566 93321 93075 92828 92580 92331 92081 91830 91578 91325 91071 Columns 256 through 270 90816 90560 90303 90045 89786 89526 89265 89003 88740 88476 88211 87945 87678 87410 87141 Columns 271 through 285 86871 86600 86328 86055 85781 85506 85230 84953 84675 84396 84116 83835 83553 83270 82986 Columns 286 through 300 82701 82415 82128 81840 81551 81261 80970 80678 80385 80091 79796 79500 79203 78905 78606 Columns 301 through 315 78306 78005 77703 77400 77096 76791 76485 76178 75870 75561 75251 74940 74628 74315 74001 Columns 316 through 330 73686 73370 73053 72735 72416 72096 71775 71453 71130 70806 70481 70155 69828 69500 69171 Columns 331 through 345 68841 68510 68178 67845 67511 67176 66840 66503 66165 65826 65486 65145 64803 64460 64116 Columns 346 through 360 63771 63425 63078 62730 62381 62031 61680 61328 60975 60621 60266 59910 59553 59195 58836 Columns 361 through 375 58476 58115 57753 57390 57026 56661 56295 55928 55560 55191 54821 54450 54078 53705 53331 Columns 376 through 390 52956 52580 52203 51825 51446 51066 50685 50303 49920 49536 49151 48765 48378 47990 47601 Columns 391 through 405 47211 46820 46428 46035 45641 45246 44850 44453 44055 43656 43256 42855 42453 42050 41646 Columns 406 through 420 41241 40835 40428 40020 39611 39201 38790 38378 37965 37551 37136 36720 36303 35885 35466 Columns 421 through 435 35046 34625 34203 33780 33356 32931 32505 32078 31650 31221 30791 30360 29928 29495 29061 Columns 436 through 450 28626 28190 27753 27315 26876 26436 25995 25553 25110 24666 24221 23775 23328 22880 22431 Columns 451 through 465 21981 21530 21078 20625 20171 19716 19260 18803 18345 17886 17426 16965 16503 16040 15576 Columns 466 through 480 15111 14645 14178 13710 13241 12771 12300 11828 11355 10881 10406 9930 9453 8975 8496 Columns 481 through 495 8016 7535 7053 6570 6086 5601 5115 4628 4140 3651 3161 2670 2178 1685 1191 Columns 496 through 510 696 200 697 199 698 198 699 197 700 196 701 195 702 194 703 Columns 511 through 525 193 704 192 705 191 706 190 707 189 708 188 709 187 710 186 Columns 526 through 540 711 185 712 184 713 183 714 182 715 181 716 180 717 179 718 Columns 541 through 555 178 719 177 720 176 721 175 722 174 723 173 724 172 725 171 Columns 556 through 570 726 170 727 169 728 168 729 167 730 166 731 165 732 164 733 Columns 571 through 585 163 734 162 735 161 736 160 737 159 738 158 739 157 740 156 Columns 586 through 600 741 155 742 154 743 153 744 152 745 151 746 150 747 149 748 Columns 601 through 615 148 749 147 750 146 751 145 752 144 753 143 754 142 755 141 Columns 616 through 630 756 140 757 139 758 138 759 137 760 136 761 135 762 134 763 Columns 631 through 645 133 764 132 765 131 766 130 767 129 768 128 769 127 770 126 Columns 646 through 660 771 125 772 124 773 123 774 122 775 121 776 120 777 119 778 Columns 661 through 675 118 779 117 780 116 781 115 782 114 783 113 784 112 785 111 Columns 676 through 690 786 110 787 109 788 108 789 107 790 106 791 105 792 104 793 Columns 691 through 705 103 794 102 795 101 796 100 797 99 798 98 799 97 800 96 Columns 706 through 720 801 95 802 94 803 93 804 92 805 91 806 90 807 ...

6   Pass
x = 123456789; y_correct = 46633; assert(isequal(RecamanII(x),y_correct))

seq = Columns 1 through 15 123456789 123456788 123456786 123456783 123456779 123456774 123456768 123456761 123456753 123456744 123456734 123456723 123456711 123456698 123456684 Columns 16 through 30 123456669 123456653 123456636 123456618 123456599 123456579 123456558 123456536 123456513 123456489 123456464 123456438 123456411 123456383 123456354 Columns 31 through 45 123456324 123456293 123456261 123456228 123456194 123456159 123456123 123456086 123456048 123456009 123455969 123455928 123455886 123455843 123455799 Columns 46 through 60 123455754 123455708 123455661 123455613 123455564 123455514 123455463 123455411 123455358 123455304 123455249 123455193 123455136 123455078 123455019 Columns 61 through 75 123454959 123454898 123454836 123454773 123454709 123454644 123454578 123454511 123454443 123454374 123454304 123454233 123454161 123454088 123454014 Columns 76 through 90 123453939 123453863 123453786 123453708 123453629 123453549 123453468 123453386 123453303 123453219 123453134 123453048 123452961 123452873 123452784 Columns 91 through 105 123452694 123452603 123452511 123452418 123452324 123452229 123452133 123452036 123451938 123451839 123451739 123451638 123451536 123451433 123451329 Columns 106 through 120 123451224 123451118 123451011 123450903 123450794 123450684 123450573 123450461 123450348 123450234 123450119 123450003 123449886 123449768 123449649 Columns 121 through 135 123449529 123449408 123449286 123449163 123449039 123448914 123448788 123448661 123448533 123448404 123448274 123448143 123448011 123447878 123447744 Columns 136 through 150 123447609 123447473 123447336 123447198 123447059 123446919 123446778 123446636 123446493 123446349 123446204 123446058 123445911 123445763 123445614 Columns 151 through 165 123445464 123445313 123445161 123445008 123444854 123444699 123444543 123444386 123444228 123444069 123443909 123443748 123443586 123443423 123443259 Columns 166 through 180 123443094 123442928 123442761 123442593 123442424 123442254 123442083 123441911 123441738 123441564 123441389 123441213 123441036 123440858 123440679 Columns 181 through 195 123440499 123440318 123440136 123439953 123439769 123439584 123439398 123439211 123439023 123438834 123438644 123438453 123438261 123438068 123437874 Columns 196 through 210 123437679 123437483 123437286 123437088 123436889 123436689 123436488 123436286 123436083 123435879 123435674 123435468 123435261 123435053 123434844 Columns 211 through 225 123434634 123434423 123434211 123433998 123433784 123433569 123433353 123433136 123432918 123432699 123432479 123432258 123432036 123431813 123431589 Columns 226 through 240 123431364 123431138 123430911 123430683 123430454 123430224 123429993 123429761 123429528 123429294 123429059 123428823 123428586 123428348 123428109 Columns 241 through 255 123427869 123427628 123427386 123427143 123426899 123426654 123426408 123426161 123425913 123425664 123425414 123425163 123424911 123424658 123424404 Columns 256 through 270 123424149 123423893 123423636 123423378 123423119 123422859 123422598 123422336 123422073 123421809 123421544 123421278 123421011 123420743 123420474 Columns 271 through 285 123420204 123419933 123419661 123419388 123419114 123418839 123418563 123418286 123418008 123417729 123417449 123417168 123416886 123416603 123416319 Columns 286 through 300 123416034 123415748 123415461 123415173 123414884 123414594 123414303 123414011 123413718 123413424 123413129 123412833 123412536 123412238 123411939 Columns 301 through 315 123411639 123411338 123411036 123410733 123410429 123410124 123409818 123409511 123409203 123408894 123408584 123408273 123407961 123407648 123407334 Columns 316 through 330 123407019 123406703 123406386 123406068 123405749 123405429 123405108 123404786 123404463 123404139 123403814 123403488 123403161 123402833 123402504 Columns 331 through 345 123402174 123401843 123401511 123401178 123400844 123400509 123400173 123399836 123399498 123399159 123398819 123398478 123398136 123397793 123397449 Columns 346 through 360 123397104 123396758 123396411 123396063 123395714 123395364 123395013 123394661 123394308 123393954 123393599 123393243 123392886 123392528 123392169 Columns 361 through 375 123391809 123391448 123391086 123390723 123390359 123389994 123389628 123389261 123388893 123388524 123388154 123387783 123387411 123387038 123386664 Columns 376 through 390 123386289 123385913 123385536 123385158 123384779 123384399 123384018 123383636 123383253 123382869 123382484 123382098 123381711 123381323 123380934 Columns 391 through 405 123380544 123380153 123379761 123379368 123378974 123378579 123378183 123377786 123377388 123376989 123376589 123376188 123375786 123375383 123374979 Columns 406 through 420 123374574 123374168 123373761 123373353 123372944 123372534 123372123 123371711 123371298 123370884 123370469 123370053 123369636 123369218 123368799 Columns 421 through 435 123368379 123367958 123367536 123367113 123366689 123366264 123365838 123365411 123364983 123364554 123364124 123363693 123363261 123362828 123362394 Columns 436 through 450 123361959 123361523 123361086 123360648 123360209 123359769 123359328 123358886 123358443 123357999 123357554 123357108 123356661 123356213 123355764 Columns 451 through 465 123355314 123354863 123354411 123353958 123353504 123353049 123352593 123352136 123351678 123351219 123350759 123350298 123349836 123349373 123348909 Columns 466 through 480 123348444 123347978 123347511 123347043 123346574 123346104 123345633 123345161 123344688 123344214 123343739 123343263 123342786 123342308 123341829 Columns 481 through 495 123341349 123340868 123340386 123339903 123339419 123338934 123338448 123337961 123337473 123336984 123336494 123336003 123335511 123335018 123334524 Columns 496 through 510 123334029 123333533 123333036 123332538 123332039 123331539 123331038 123330536 123330033 123329529 123329024 123328518 123328011 123327503 123326994 Columns 511 through 525 123326484 123325973 123325461 123324948 123324434 123323919 123323403 123322886 123322368 123321849 123321329 123320808 123320286 123319763 123319239 Columns 526 through 540 123318714 123318188 123317661 123317133 123316604 123316074 123315543 123315011 123314478 123313944 123313409 123312873 123312336 123311798 123311259 Columns 541 through 555 123310719 123310178 123309636 123309093 123308549 123308004 123307458 123306911 123306363 123305814 123305264 123304713 123304161 123303608 123303054 Columns 556 through 570 123302499 123301943 123301386 123300828 123300269 123299709 123299148 123298586 123298023 123297459 123296894 123296328 123295761 123295193 123294624 Columns 571 through 585 123294054 123293483 123292911 123292338 123291764 123291189 123290613 123290036 123289458 123288879 123288299 123287718 123287136 123286553 123285969 Columns 586 through 600 123285384 123284798 123284211 123283623 123283034 123282444 123281853 123281261 123280668 123280074 123279479 123278883 123278286 123277688 123277089 Columns 601 through 615 123276489 123275888 123275286 123274683 123274079 123273474 123272868 123272261 123271653 123271044 123270434 123269823 123269211 123268598 123267984 Columns 616 through 630 123267369 123266753 123266136 123265518 123264899 123264279 123263658 123263036 123262413 123261789 123261164 123260538 123259911 123259283 123258654 Columns 631 through 645 123258024 123257393 123256761 123256128 123255494 123254859 123254223 123253586 123252948 123252309 123251669 123251028 123250386 123249743 123249099 Columns 646 through 660 123248454 123247808 123247161 123246513 123245864 123245214 123244563 123243911 123243258 123242604 123241949 123241293 123240636 123239978 123239319 Columns 661 through 675 123238659 123237998 123237336 123236673 123236009 123235344 123234678 123234011 123233343 123232674 123232004 123231333 123230661 123229988 123229314 Columns 676 through 690 123228639 123227963 123227286 123226608 123225929 123225249 123224568 123223886 123223203 123222519 123221834 123221148 123220461 123219773 123219084 Columns 691 through 705 123218394 123217703 123217011 123216318 123215624 123214929 123214233 123213536 123212838 123212139 123211439 123210738 123210036 123209333 123208629 Columns 706 through 720 123207924 123207218 123206511 123205803 123205094 123204384 123203673 123202961 123202248 123201534 123200819 123200103 123199386 ...

Suggested Problems