OFFSET
1,3
COMMENTS
Let the decimal expansion of m = d(0)d(1)...d(p). Numbers such that Sum_{k=0..p} (d(k)!)^2 is square.
LINKS
Jinyuan Wang, Table of n, a(n) for n = 1..1487
EXAMPLE
a(16) = 244 is in the sequence because (2!)^2 + (4!)^2 + (4!)^2 = 1156 = 34^2.
MAPLE
with(numtheory):for n from 0 to 10000 do:l:=length(n):n0:=n:s:=0:for m from
1 to l do:q:=n0:u:=irem(q, 10):v:=iquo(q, 10):n0:=v :s:=s+(u!)^2:od: q:=sqrt(s):if
floor(q)= q then printf(`%d, `, n):else fi:od:
MATHEMATICA
Select[Range[0, 10000], IntegerQ[Sqrt[Total[(IntegerDigits[#]!)^2]]]&] (* Harvey P. Dale, Dec 19 2011 *)
PROG
(Python)
from itertools import count, islice, combinations_with_replacement
from math import factorial
from sympy.ntheory.primetest import is_square
from sympy.utilities.iterables import multiset_permutations
def A173689_gen(): # generator of terms
yield 0
for l in count(0):
for i in range(1, 10):
fi = factorial(i)**2
yield from sorted(int(str(i)+''.join(map(str, k))) for j in combinations_with_replacement(range(10), l) for k in multiset_permutations(j) if is_square(fi+sum(map(lambda n:factorial(n)**2, j))))
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Michel Lagneau, Nov 25 2010
EXTENSIONS
Offset changed to 1 by Jinyuan Wang, Feb 26 2020
STATUS
approved