OFFSET
1,3
EXAMPLE
6 = 2 * triangular(2).
4851 = 21 * triangular(21).
MATHEMATICA
TriangularQ[n_] := IntegerQ[Sqrt[1 + 8*n]]; s = Select[Range[0, 10000], TriangularQ[#^2 (# + 1)/2] &]; s^2 (s + 1)/2 (* T. D. Noe, Jun 12 2013 *)
PROG
(Python)
def isTriangular(a):
sr = 1 << (int.bit_length(int(a)) >> 1)
a += a
while a < sr*(sr+1): sr>>=1
b = sr>>1
while b:
s = sr+b
if a >= s*(s+1): sr = s
b>>=1
return (a==sr*(sr+1))
for n in range(10000):
product = n*n*(n+1)//2
if isTriangular(product): print(product, end=', ')
CROSSREFS
KEYWORD
nonn
AUTHOR
Alex Ratushnyak, Jun 09 2013
STATUS
approved