Cody

Problem 235. Project Euler: Problem 4, Palindromic numbers

Solution 1997451

Submitted on 31 Oct 2019 by Le Cong Hieu
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))

chuoi = 906609 chuoi = 906609 886688 chuoi = 906609 886688 888888 chuoi = 906609 886688 888888 861168 chuoi = 906609 886688 888888 861168 888888 chuoi = 906609 886688 888888 861168 888888 861168 chuoi = 906609 886688 888888 861168 888888 861168 886688 chuoi = 906609 886688 888888 861168 888888 861168 886688 824428 chuoi = 906609 886688 888888 861168 888888 861168 886688 824428 906609 chuoi = 906609 886688 888888 861168 888888 861168 886688 824428 906609 819918 chuoi = 906609 886688 888888 861168 888888 861168 886688 824428 906609 819918 824428 chuoi = 906609 886688 888888 861168 888888 861168 886688 824428 906609 819918 824428 819918

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

chuoi = 99000099 chuoi = 99000099 99000099

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

chuoi = 0 chuoi = 0 9009 chuoi = 0 9009 8118 chuoi = 0 9009 8118 7227 chuoi = 0 9009 8118 7227 6336 chuoi = 0 9009 8118 7227 6336 5445 chuoi = 0 9009 8118 7227 6336 5445 4554 chuoi = 0 9009 8118 7227 6336 5445 4554 3663 chuoi = 0 9009 8118 7227 6336 5445 4554 3663 2772 chuoi = 0 9009 8118 7227 6336 5445 4554 3663 2772 1881 chuoi = 0 9009 8118 7227 6336 5445 4554 3663 2772 1881 99 chuoi = 0 9009 8118 7227 6336 5445 4554 3663 2772 1881 99 0 chuoi = 0 9009 8118 7227 6336 5445 4554 3663 2772 1881 99 0 686 chuoi = 0 9009 8118 7227 6336 5445 4554 3663 2772 1881 99 0 686 0 chuoi = 0 9009 8118 7227 6336 5445 4554 3663 2772 1881 99 0 686 0 5335 chuoi = Columns 1 through 15 0 9009 8118 7227 6336 5445 4554 3663 2772 1881 99 0 686 0 5335 Column 16 0 chuoi = Columns 1 through 15 0 9009 8118 7227 6336 5445 4554 3663 2772 1881 99 0 686 0 5335 Columns 16 through 17 0 8448 chuoi = Columns 1 through 15 0 9009 8118 7227 6336 5445 4554 3663 2772 1881 99 0 686 0 5335 Columns 16 through 18 0 8448 6336 chuoi = Columns 1 through 15 0 9009 8118 7227 6336 5445 4554 3663 2772 1881 99 0 686 0 5335 Columns 16 through 19 0 8448 6336 4224 chuoi = Columns 1 through 15 0 9009 8118 7227 6336 5445 4554 3663 2772 1881 99 0 686 0 5335 Columns 16 through 20 0 8448 6336 4224 2112 chuoi = Columns 1 through 15 0 9009 8118 7227 6336 5445 4554 3663 2772 1881 99 0 686 0 5335 Columns 16 through 21 0 8448 6336 4224 2112 0 chuoi = Columns 1 through 15 0 9009 8118 7227 6336 5445 4554 3663 2772 1881 99 0 686 0 5335 Columns 16 through 22 0 8448 6336 4224 2112 0 5225 chuoi = Columns 1 through 15 0 9009 8118 7227 6336 5445 4554 3663 2772 1881 99 0 686 0 5335 Columns 16 through 23 0 8448 6336 4224 2112 0 5225 0 chuoi = Columns 1 through 15 0 9009 8118 7227 6336 5445 4554 3663 2772 1881 99 0 686 0 5335 Columns 16 through 24 0 8448 6336 4224 2112 0 5225 0 282 chuoi = Columns 1 through 15 0 9009 8118 7227 6336 5445 4554 3663 2772 1881 99 0 686 0 5335 Columns 16 through 25 0 8448 6336 4224 2112 0 5225 0 282 0 chuoi = Columns 1 through 15 0 9009 8118 7227 6336 5445 4554 3663 2772 1881 99 0 686 0 5335 Columns 16 through 26 0 8448 6336 4224 2112 0 5225 0 282 0 5115 chuoi = Columns 1 through 15 0 9009 8118 7227 6336 5445 4554 3663 2772 1881 99 0 686 0 5335 Columns 16 through 27 0 8448 6336 4224 2112 0 5225 0 282 0 5115 0 chuoi = Columns 1 through 15 0 9009 8118 7227 6336 5445 4554 3663 2772 1881 99 0 686 0 5335 Columns 16 through 28 0 8448 6336 4224 2112 0 5225 0 282 0 5115 0 828 chuoi = Columns 1 through 15 0 9009 8118 7227 6336 5445 4554 3663 2772 1881 99 0 686 0 5335 Columns 16 through 29 0 8448 6336 4224 2112 0 5225 0 282 0 5115 0 828 0 chuoi = Columns 1 through 15 0 9009 8118 7227 6336 5445 4554 3663 2772 1881 99 0 686 0 5335 Columns 16 through 30 0 8448 6336 4224 2112 0 5225 0 282 0 5115 0 828 0 9009 chuoi = Columns 1 through 15 0 9009 8118 7227 6336 5445 4554 3663 2772 1881 99 0 686 0 5335 Columns 16 through 30 0 8448 6336 4224 2112 0 5225 0 282 0 5115 0 828 0 9009 Column 31 8008 chuoi = Columns 1 through 15 0 9009 8118 7227 6336 5445 4554 3663 2772 1881 99 0 686 0 5335 Columns 16 through 30 0 8448 6336 4224 2112 0 5225 0 282 0 5115 0 828 0 9009 Columns 31 through 32 8008 7007 chuoi = Columns 1 through 15 0 9009 8118 7227 6336 5445 4554 3663 2772 1881 99 0 686 0 5335 Columns 16 through 30 0 8448 6336 4224 2112 0 5225 0 282 0 5115 0 828 0 9009 Columns 31 through 33 8008 7007 6006 chuoi = Columns 1 through 15 0 9009 8118 7227 6336 5445 4554 3663 2772 1881 99 0 686 0 5335 Columns 16 through 30 0 8448 6336 4224 2112 0 5225 0 282 0 5115 0 828 0 9009 Columns 31 through 34 8008 7007 6006 5005 chuoi = Columns 1 through 15 0 9009 8118 7227 6336 5445 4554 3663 2772 1881 99 0 686 0 5335 Columns 16 through 30 0 8448 6336 4224 2112 0 5225 0 282 0 5115 0 828 0 9009 Columns 31 through 35 8008 7007 6006 5005 4004 chuoi = Columns 1 through 15 0 9009 8118 7227 6336 5445 4554 3663 2772 1881 99 0 686 0 5335 Columns 16 through 30 0 8448 6336 4224 2112 0 5225 0 282 0 5115 0 828 0 9009 Columns 31 through 36 8008 7007 6006 5005 4004 3003 chuoi = Columns 1 through 15 0 9009 8118 7227 6336 5445 4554 3663 2772 1881 99 0 686 0 5335 Columns 16 through 30 0 8448 6336 4224 2112 0 5225 0 282 0 5115 ...

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

chuoi = 6167616 chuoi = 6167616 6145416 chuoi = 6167616 6145416 6014106 chuoi = 6167616 6145416 6014106 6145416 chuoi = 6167616 6145416 6014106 6145416 6167616 chuoi = 6167616 6145416 6014106 6145416 6167616 6039306 chuoi = 6167616 6145416 6014106 6145416 6167616 6039306 6039306 chuoi = 6167616 6145416 6014106 6145416 6167616 6039306 6039306 5870785 chuoi = 6167616 6145416 6014106 6145416 6167616 6039306 6039306 5870785 6014106 chuoi = 6167616 6145416 6014106 6145416 6167616 6039306 6039306 5870785 6014106 5870785