The decimal number, 585 = 10010010012 (binary), is palindromic in both bases.

Find the sum of all numbers, less than one million, which are palindromic in base 10 and base 2.

(Please note that the palindromic number, in either base, may not include leading zeros.)

とりあえず、簡単な方法で。

import Data.List
import Data.Char
toBin =reverse. unfoldr f
where f  = Nothing
f n =let (q,r) = divMod n 2 in Just(r,q)
toDigit ::Integer -> [Int]
toDigit = map (digitToInt).show
palind m = [n|n<-[1,3..m],(reverse.toDigit)n==toDigit n,(reverse.toBin)n==toBin n]
p036 = sum.palind$999999