%I #6 Aug 23 2014 17:44:17
%S 4,9,16,169,361,729,961,1444,10201,403225,725904
%N Squares that are the sum of four factorials.
%e These appear to be the only solutions to a! + b! + c! + d! = n^2:
%e a b c d n
%e 0 0 0 0 4
%e 0 0 0 1 4
%e 0 0 0 3 9
%e 0 0 1 1 4
%e 0 0 1 3 9
%e 0 1 1 1 4
%e 0 1 1 3 9
%e 0 2 3 6 729
%e 0 4 4 5 169
%e 0 4 8 9 403225
%e 0 5 5 5 361
%e 0 5 5 6 961
%e 0 5 7 7 10201
%e 1 1 1 1 4
%e 1 1 1 3 9
%e 1 2 3 6 729
%e 1 4 4 5 169
%e 1 4 8 9 403225
%e 1 5 5 5 361
%e 1 5 5 6 961
%e 1 5 7 7 10201
%e 2 2 3 3 16
%e 2 2 6 6 1444
%e 4 5 9 9 725904
%e 1!+2!+3!+6! = 729 = 27^2. This shows that 4 factorials can add to a cube.
%t e = 75; a = Union[ Flatten[ Table[a! + b! + c! + d!, {a, 1, e}, {b, a, e}, {c, b, e}, {d, c, e}]]]; l = Length[a]; Do[ If[ IntegerQ[ Sqrt[ a[[i]] ]], Print[ a[[i]] ]], {i, 1, l}]
%t Select[Union[Total/@Tuples[Range[10]!,4]],IntegerQ[Sqrt[#]]&] (* _Harvey P. Dale_, Aug 23 2014 *)
%o (PARI) sum4factsq(n) = { for(a1=0,n, for(a2=a1,n, for(a3=a2,n, for(a4=a3,n, z = a1!+a2!+a3!+a4!; if(issquare(z),print(a1" "a2" "a3" "a4" "z)) ) ) ) ) }
%Y Cf. A082875.
%K easy,nonn
%O 0,1
%A _Cino Hilliard_, May 25 2003
%E Edited, corrected and extended by _Robert G. Wilson v_, May 26 2003