Largest palindrome product


Fork me on GitHub
2014-09-11

Problem 004: Largest palindrome product

Description:

A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.

Find the largest palindrome made from the product of two 3-digit numbers.


Solution:
1:010:pp5558***04p>10g1+::10p04g-00g \#v_1+:00p\$1:10p\:04g- #v_$$03g.@
                  ^         v $<       >1# 0# 1# p# *# :# v#  <
   v_v#-g1-g20g10g 1g20<p201<v_^#:/+55p10+1g10p1g10%+55:  <
   $ >02g1+:02p 01 g - |     >                            ^
   >              ^    >:03g\`#v_03pv
                  ^           $<   0<
Start
??
Pause
Reset
Output:
Stack:   (0)

Explanation:

Again we can write our program fast enough to brute-force the solution. So we iterate through every possible 3-digit product and check if its a palindrom.


Interpreter steps: 230 611 114
Execution time (BefunExec): 1min 17s (2.96 MHz)
Program size: 71 x 6 (fully conform befunge-93)
Solution: 906609
Solved at: 2014-09-11



made with vanilla PHP and MySQL, no frameworks, no bootstrap, no unnecessary* javascript