login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A230364
Triangular numbers representable as b! + c^2.
0
1, 3, 6, 10, 15, 28, 55, 66, 105, 120, 136, 171, 231, 325, 406, 465, 561, 820, 1081, 1770, 2016, 2145, 2211, 3160, 3321, 5778, 7750, 11026, 13041, 13695, 15400, 17020, 23220, 34716, 41616, 55945, 60031, 70876, 75078, 100576, 106953, 126756, 196251, 260281, 263175, 374545
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