OFFSET
1,2
MATHEMATICA
nf = 9; tb = Table[b!, {b, nf}]; nn = Ceiling[Sqrt[tb[[-1]]]]; ts = Range[0, nn]^2; tri = Table[n (n + 1)/2, {n, (Sqrt[1 + 8 nn^2] - 1)/2}]; u = Union[Select[Flatten[Outer[Plus, tb, ts]], # <= nn^2 &]]; Intersection[tri, u] (* T. D. Noe, Oct 18 2013 *)
PROG
(Python)
import math
factorials = [1] * 1024
f = 1
for n in range(2, 1025):
f *= n
factorials[n-1] = f
for n in range(1<<30):
t = n*(n+1)//2
for a in factorials:
r = t - a
if r<0: break
b = int(math.sqrt(r))
if b*b==r:
print(t, end=', ')
break
CROSSREFS
KEYWORD
nonn
AUTHOR
Alex Ratushnyak, Oct 17 2013
STATUS
approved