OFFSET
0,3
COMMENTS
Triangular(k) = k*(k+1)/2.
LINKS
Chai Wah Wu, Table of n, a(n) for n = 0..10000
FORMULA
a(A001109(n)) = 0.
MATHEMATICA
TriangularQ[n_] := IntegerQ[Sqrt[1 + 8*n]]; Table[k = 0; While[! TriangularQ[n^2 + k*(k + 1)/2], k++]; k, {n, 0, 68}] (* T. D. Noe, Nov 21 2013 *)
PROG
(Python)
from __future__ import division
from sympy import divisors
def A232179(n):
if n == 0:
return 0
t = 2*n**2
ds = divisors(t)
for i in range(len(ds)//2-1, -1, -1):
x = ds[i]
y = t//x
a, b = divmod(y-x, 2)
if b:
return a
return -1 # Chai Wah Wu, Sep 12 2017
(PARI) a(n) = {my(k = 0); while (! ispolygonal(n^2 + k*(k+1)/2, 3), k++); k; } \\ Michel Marcus, Sep 15 2017
CROSSREFS
Cf. A082183 (least k>0 such that triangular(n) + triangular(k) is a triangular number).
Cf. A232177 (least k>0 such that triangular(n) + triangular(k) is a square).
Cf. A232176 (least k>0 such that n^2 + triangular(k) is a square).
Cf. A101157 (least k>0 such that triangular(n) + k^2 is a triangular number).
Cf. A232178 (least k>=0 such that triangular(n) + k^2 is a square).
KEYWORD
nonn
AUTHOR
Alex Ratushnyak, Nov 20 2013
STATUS
approved