login
A232179
Least k >= 0 such that n^2 + triangular(k) is a triangular number.
4
0, 0, 3, 1, 15, 2, 0, 3, 63, 4, 8, 5, 11, 6, 20, 3, 255, 8, 1, 9, 3, 10, 38, 11, 59, 12, 45, 13, 8, 14, 2, 15, 1023, 16, 59, 0, 24, 18, 66, 19, 51, 20, 3, 21, 44, 10, 80, 23, 251, 24, 42, 25, 68, 26, 4, 27, 39, 28, 101, 29, 10, 30, 108, 8, 4095, 32, 5, 33, 128
OFFSET
0,3
COMMENTS
Triangular(k) = k*(k+1)/2.
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).
Sequence in context: A318142 A176727 A080924 * A128042 A108083 A163239
KEYWORD
nonn
AUTHOR
Alex Ratushnyak, Nov 20 2013
STATUS
approved