Project Euler: Problem 4

Challenge:

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.

Programming Language:

LISP

Solution:

(defun 3pal()
  (defparameter l3pal 0)
  (loop for x downfrom 999 to 111
     do (loop for y downfrom 999 to 111
	   do (if (equal (write-to-string (* x y)) (reverse (write-to-string (* x y))))
		  (if (> (* x y) l3pal)
		      (setq l3pal (* x y))))))
  (format t "~a ~%" l3pal))

Overview:

Coming soon…