/*
Euler #34 in Picat.
Problem 34
"""
145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145.
Find the sum of all numbers which are equal to the sum of the
factorial of their digits.
Note: as 1! = 1 and 2! = 2 are not sums they are not included.
"""
This Picat model was created by Hakan Kjellerstrand, hakank@gmail.com
See also my Picat page: http://www.hakank.org/picat/
*/
main => go.
go => time(euler34).
euler34 =>
Sum = sum([ N : N in 10..100000,
N = sum([I.to_integer().factorial() : I in N.to_string()])]),
println(Sum).