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.


In [5]:
open System 

let rev (str:string) =
    let strArrayRev = str.ToCharArray() |> Array.rev
    String.Join("", strArrayRev)

let isPalindrome n = string(n) = rev(string(n))

seq {
    for m in 100 .. 999 do
        for n in m .. 999 do
            if isPalindrome (m*n) then yield (m*n)
}
|> Seq.toList
|> List.sort
|> List.last


Out[5]:
906609

In [ ]: