# Project Euler Problem 36

Project Euler Problem 36 solution is succinct; function **isPalindromic **checks that base 2 and base 10 presentations of a number **n** are both palindromes:

open System let isPalindrom (s: string) = String(s.ToCharArray() |> Array.rev) = s let isPalindromic (n: int) = isPalindrom (Convert.ToString (n, 2)) && isPalindrom (string n) let problem036 () = {1..999999} |> Seq.filter isPalindromic |> Seq.sum

Advertisements

Leave a Comment