VOOZH about

URL: https://oeis.org/A389657

⇱ A389657 - OEIS


login
A389657
a(n) is zero if n is a square, otherwise a(n) is the least triangular number m > 0 such that m*n is a triangular number.
2
0, 3, 1, 0, 3, 1, 3, 15, 0, 1, 6, 3, 6, 15, 1, 0, 78, 21, 10, 6, 1, 3, 45, 190, 0, 3, 55, 1, 15, 10, 15, 28203, 45, 105, 3, 0, 465, 120, 55, 3, 21, 15, 21, 3570, 1, 6, 210, 861, 0, 6, 3, 15, 105, 21945, 1, 21, 3, 66, 26565, 91
OFFSET
1,2
COMMENTS
Conjecture: Each positive rational number r with sqrt(r) irrational can be written as m*(m+1)/(n*(n+1)) = T(m)/T(n), where m and n are positive integers, and T(k) denotes the triangular number k*(k+1)/2.
This conjecture implies that a(n) exists for any positive integer n.
After the author posed the conjecture to MathOverflow, Alexander Kalmynin provided a proof of the conjecture.
For given nonsquare n, the smallest integer x > 1 is sought for which the generalized Pell equation z^2 - n*x^2 = 1 - n has an integer solution z. If such an x is found the corresponding triangular number is m = (x^2 - 1)/8. - Peter Luschny, Oct 10 2025
LINKS
Chai Wah Wu, Table of n, a(n) for n = 1..10000 (terms 1..348 from Zhi-Wei Sun)
Alexander Kalmynin, Answer to Question 501457, MathOverflow, Oct 2025.
EXAMPLE
a(14) = 15 with both 15 = 5*6/2 and 15*14 = 20*21/2 triangular numbers.
From Peter Luschny, Oct 10 2025: (Start):
Illustrating the Pell-Ansatz as described in the comment for n = 17. Search x = 3, 5, 7, ..., 25. So z = 17*25^2 + (1 - 17) = 10609 = 103^2 and m = (25^2 - 1) / 8 = 78. Thus a(17) = 78. (End)
MAPLE
A389657 := proc(n) local x, y, s;
if issqr(n) then return 0 fi;
s := false;
for x from 3 by 2 while not s do
y := x * x - 1;
s := issqr(n * y + 1);
od; iquo(y, 8) end: # Peter Luschny, Oct 11 2025
MATHEMATICA
SQ[n_]:=IntegerQ[Sqrt[n]]; tab={}; Do[If[SQ[n], tab=Append[tab, 0]; Goto[aa]]; k=1; Label[bb]; m=k(k+1)/2; If[SQ[8m*n+1], tab=Append[tab, m]; Goto[aa]]; k=k+1; Goto[bb]; Label[aa], {n, 1, 60}]; Print[tab]
PROG
(Python)
import math
def is_square(n: int) -> bool:
if n < 0: return False
r = math.isqrt(n)
return r * r == n
def a(n: int) -> int: # by solving a Pell equation
if is_square(n): return 0
x = 3
while True:
if is_square(n * x * x + (1 - n)):
d, m = divmod(x * x - 1, 8)
if m == 0: return d
x += 2
print([a(n) for n in range(1, 61)]) # Peter Luschny, Oct 10 2025
(Python)
from sympy.ntheory.primetest import is_square
from sympy.solvers.diophantine.diophantine import diop_DN
def A389657(n):
if is_square(n): return 0
c, a, b = None, diop_DN(n, 1-n), diop_DN(n, 1)
while c is None:
a2 = []
for r, s in a:
if (sa:=abs(s))>1 and sa&1:
c = min(c, sa) if c is not None else sa
for t, u in b:
w, d = r*u+s*t, r*t+s*u*n
if (wa:=abs(w))>1 and wa&1:
c = min(c, wa) if c is not None else wa
a2.extend([(d, w), (d, -w), (-d, w), (-d, -w)])
a.extend(a2)
return c*c-1>>3 # Chai Wah Wu, Oct 11 2025
CROSSREFS
Different from A227054 which is 1 at triangular numbers that are squares (A001110).
Sequence in context: A058600 A133704 A160019 * A227054 A265605 A035629
KEYWORD
nonn
AUTHOR
Zhi-Wei Sun, Oct 09 2025
STATUS
approved