9 lines
319 B
Haskell
9 lines
319 B
Haskell
-- 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)
|
|
main = print $ sum $ take 11 $ filter (all isPrime . truncations) [11..]
|