-- Find the sum of the only eleven primes that are both truncatable from left -- to right and right to left. import Euler import Data.Array.Unboxed truncations n = map fromDigits $ filter (not . null) $ inits (toDigits n) ++ tails (toDigits n) isPrimeArr = isPrimeArray 1000000 isPrime n = n >= 2 && isPrimeArr!n /= 0 main = print $ sum $ take 11 $ filter (all isPrime . truncations) [11..]