Cody

# Problem 235. Project Euler: Problem 4, Palindromic numbers

Solution 1693501

Submitted on 16 Dec 2018 by Augusto Mazzei
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 = 999; y_correct = 906609; assert(isequal(euler004(x),y_correct))

t = Columns 1 through 15 998001 997002 996003 995004 994005 993006 992007 991008 990009 989010 988011 987012 986013 985014 984015 0 996004 995006 994008 993010 992012 991014 990016 989018 988020 987022 986024 985026 984028 983030 0 0 994009 993012 992015 991018 990021 989024 988027 987030 986033 985036 984039 983042 982045 0 0 0 992016 991020 990024 989028 988032 987036 986040 985044 984048 983052 982056 981060 0 0 0 0 990025 989030 988035 987040 986045 985050 984055 983060 982065 981070 980075 0 0 0 0 0 988036 987042 986048 985054 984060 983066 982072 981078 980084 979090 0 0 0 0 0 0 986049 985056 984063 983070 982077 981084 980091 979098 978105 0 0 0 0 0 0 0 984064 983072 982080 981088 980096 979104 978112 977120 0 0 0 0 0 0 0 0 982081 981090 980099 979108 978117 977126 976135 0 0 0 0 0 0 0 0 0 980100 979110 978120 977130 976140 975150 0 0 0 0 0 0 0 0 0 0 978121 977132 976143 975154 974165 0 0 0 0 0 0 0 0 0 0 0 976144 975156 974168 973180 0 0 0 0 0 0 0 0 0 0 0 0 974169 973182 972195 0 0 0 0 0 0 0 0 0 0 0 0 0 972196 971210 0 0 0 0 0 0 0 0 0 0 0 0 0 0 970225 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

2   Pass
x = 9999; y_correct = 99000099; assert(isequal(euler004(x),y_correct))

t = Columns 1 through 15 99980001 99970002 99960003 99950004 99940005 99930006 99920007 99910008 99900009 99890010 99880011 99870012 99860013 99850014 99840015 0 99960004 99950006 99940008 99930010 99920012 99910014 99900016 99890018 99880020 99870022 99860024 99850026 99840028 99830030 0 0 99940009 99930012 99920015 99910018 99900021 99890024 99880027 99870030 99860033 99850036 99840039 99830042 99820045 0 0 0 99920016 99910020 99900024 99890028 99880032 99870036 99860040 99850044 99840048 99830052 99820056 99810060 0 0 0 0 99900025 99890030 99880035 99870040 99860045 99850050 99840055 99830060 99820065 99810070 99800075 0 0 0 0 0 99880036 99870042 99860048 99850054 99840060 99830066 99820072 99810078 99800084 99790090 0 0 0 0 0 0 99860049 99850056 99840063 99830070 99820077 99810084 99800091 99790098 99780105 0 0 0 0 0 0 0 99840064 99830072 99820080 99810088 99800096 99790104 99780112 99770120 0 0 0 0 0 0 0 0 99820081 99810090 99800099 99790108 99780117 99770126 99760135 0 0 0 0 0 0 0 0 0 99800100 99790110 99780120 99770130 99760140 99750150 0 0 0 0 0 0 0 0 0 0 99780121 99770132 99760143 99750154 99740165 0 0 0 0 0 0 0 0 0 0 0 99760144 99750156 99740168 99730180 0 0 0 0 0 0 0 0 0 0 0 0 99740169 99730182 99720195 0 0 0 0 0 0 0 0 0 0 0 0 0 99720196 99710210 0 0 0 0 0 0 0 0 0 0 0 0 0 0 99700225 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

3   Pass
x = 100; y_correct = 9009; assert(isequal(euler004(x),y_correct))

t = Columns 1 through 15 10000 9900 9800 9700 9600 9500 9400 9300 9200 9100 9000 8900 8800 8700 8600 0 9801 9702 9603 9504 9405 9306 9207 9108 9009 8910 8811 8712 8613 8514 0 0 9604 9506 9408 9310 9212 9114 9016 8918 8820 8722 8624 8526 8428 0 0 0 9409 9312 9215 9118 9021 8924 8827 8730 8633 8536 8439 8342 0 0 0 0 9216 9120 9024 8928 8832 8736 8640 8544 8448 8352 8256 0 0 0 0 0 9025 8930 8835 8740 8645 8550 8455 8360 8265 8170 0 0 0 0 0 0 8836 8742 8648 8554 8460 8366 8272 8178 8084 0 0 0 0 0 0 0 8649 8556 8463 8370 8277 8184 8091 7998 0 0 0 0 0 0 0 0 8464 8372 8280 8188 8096 8004 7912 0 0 0 0 0 0 0 0 0 8281 8190 8099 8008 7917 7826 0 0 0 0 0 0 0 0 0 0 8100 8010 7920 7830 7740 0 0 0 0 0 0 0 0 0 0 0 7921 7832 7743 7654 0 0 0 0 0 0 0 0 0 0 0 0 7744 7656 7568 0 0 0 0 0 0 0 0 0 0 0 0 0 7569 7482 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7396 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 16 through 26 8500 8400 8300 8200 8100 8000 7900 7800 7700 7600 7500 8415 8316 8217 8118 8019 7920 7821 7722 7623 7524 7425 8330 8232 8134 8036 7938 7840 7742 7644 7546 7448 7350 8245 8148 8051 7954 7857 7760 7663 7566 7469 7372 7275 8160 8064 7968 7872 7776 7680 7584 7488 7392 7296 7200 8075 7980 7885 7790 7695 7600 7505 7410 7315 7220 7125 7990 7896 7802 7708 7614 7520 7426 7332 7238 7144 7050 7905 7812 7719 7626 7533 7440 7347 7254 7161 7068 6975 7820 7728 7636 7544 7452 7360 7268 7176 7084 6992 6900 7735 7644 7553 7462 7371 7280 7189 7098 7007 6916 6825 7650 7560 7470 7380 7290 7200 7110 7020 6930 6840 6750 7565 7476 7387 7298 7209 7120 7031 6942 6853 6764 6675 7480 7392 7304 7216 7128 7040 6952 6864 6776 6688 6600 7395 7308 7221 7134 7047 6960 6873 6786 6699 6612 6525 7310 7224 7138 7052 6966 6880 6794 6708 6622 6536 6450 7225 7140 7055 6970 6885 6800 6715 6630 6545 6460 6375 0 7056 6972 6888 6804 6720 6636 6552 6468 6384 6300 0 0 6889 6806 6723 6640 6557 6474 6391 6308 6225 0 0 0 6724 6642 6560 6478 6396 6314 6232 6150 0 0 0 0 6561 6480 6399 6318 6237 6156 6075 0 0 0 0 0 6400 6320 6240 6160 6080 6000 0 0 0 0 0 0 6241 6162 6083 6004 5925 0 0 0 0 0 0 0 6084 6006 5928 5850 0 0 0 0 0 0 0 0 5929 5852 5775 0 0 0 0 0 0 0 0 0 5776 5700 0 0 0 0 0 0 0 0 0 0 5625 ans = 9009

4   Pass
x = 2500; y_correct = 6167616; assert(isequal(euler004(x),y_correct))

t = Columns 1 through 15 6250000 6247500 6245000 6242500 6240000 6237500 6235000 6232500 6230000 6227500 6225000 6222500 6220000 6217500 6215000 0 6245001 6242502 6240003 6237504 6235005 6232506 6230007 6227508 6225009 6222510 6220011 6217512 6215013 6212514 0 0 6240004 6237506 6235008 6232510 6230012 6227514 6225016 6222518 6220020 6217522 6215024 6212526 6210028 0 0 0 6235009 6232512 6230015 6227518 6225021 6222524 6220027 6217530 6215033 6212536 6210039 6207542 0 0 0 0 6230016 6227520 6225024 6222528 6220032 6217536 6215040 6212544 6210048 6207552 6205056 0 0 0 0 0 6225025 6222530 6220035 6217540 6215045 6212550 6210055 6207560 6205065 6202570 0 0 0 0 0 0 6220036 6217542 6215048 6212554 6210060 6207566 6205072 6202578 6200084 0 0 0 0 0 0 0 6215049 6212556 6210063 6207570 6205077 6202584 6200091 6197598 0 0 0 0 0 0 0 0 6210064 6207572 6205080 6202588 6200096 6197604 6195112 0 0 0 0 0 0 0 0 0 6205081 6202590 6200099 6197608 6195117 6192626 0 0 0 0 0 0 0 0 0 0 6200100 6197610 6195120 6192630 6190140 0 0 0 0 0 0 0 0 0 0 0 6195121 6192632 6190143 6187654 0 0 0 0 0 0 0 0 0 0 0 0 6190144 6187656 6185168 0 0 0 0 0 0 0 0 0 0 0 0 0 6185169 6182682 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6180196 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...