login
A389664
a(n) = 1 if n is a square, otherwise a(n) is the least integer m > 1 such that (m^2 - 1)*n + 1 is a square.
2
1, 5, 3, 1, 2, 3, 5, 2, 1, 3, 7, 5, 4, 11, 3, 1, 4, 13, 9, 7, 2, 5, 19, 4, 1, 5, 21, 3, 11, 9, 11, 14, 2, 29, 5, 1, 6, 31, 21, 2, 13, 11, 13, 169, 3, 7, 41, 6, 1, 7, 5, 11, 22, 419, 3, 2, 5, 23, 461, 27, 8, 55, 7, 1, 2, 3, 49, 29, 11, 5, 17, 15, 17, 3269, 23
OFFSET
1,2
COMMENTS
Conjecture: For any positive rational number r with sqrt(r) irrational, we have r = (m^2-1)/(n^2-1) for some integers m and n greater than one.
This conjecture implies that a(n) exists for all n > 0. Clearly, 4*(m^2-1) = n^2-1 (i.e. (2m)^2 - n^2 = 3) fails for any m,n = 2,3,....
Note that (2k+1)^2 - 1 = 8*T(k), where T(k) is the triangular number k*(k+1)/2.
After the author posed the conjecture to MathOverflow, Alexander Kalmynin provided a proof of the conjecture.
LINKS
Chai Wah Wu, Table of n, a(n) for n = 1..10000 (terms 1..500 from Zhi-Wei Sun)
Zhi-Wei Sun, On the sets {(m^2-1)/(n^2-1): m,n = 2,3,...} and {m(m+1)/(n(n+1)): m,n in Z^+}, Question 501454 at MathOverflow, Oct. 10, 2025.
EXAMPLE
a(44) = 169 with (169^2-1)*44 + 1 = 1256641 = 1121^2.
MATHEMATICA
SQ[n_]:=IntegerQ[Sqrt[n]];
tab={}; Do[If[SQ[n], tab=Append[tab, 1]; Goto[aa]]; m=2; Label[bb]; If[SQ[(m^2-1)n+1], tab=Append[tab, m]; Goto[aa]]; m=m+1; Goto[bb]; Label[aa], {n, 1, 80}]; Print[tab]
PROG
(PARI) a(n) = if (issquare(n), 1, my(m=2); while (!issquare((m^2-1)*n+1), m++); m); \\ Michel Marcus, Oct 11 2025
(Python)
from sympy.ntheory.primetest import is_square
from sympy.solvers.diophantine.diophantine import diop_DN
def A389664(n):
if is_square(n): return 1
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:
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:
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 # Chai Wah Wu, Oct 16 2025
CROSSREFS
KEYWORD
nonn
AUTHOR
Zhi-Wei Sun, Oct 10 2025
STATUS
approved