OFFSET
1,3
COMMENTS
The fundamental solution of the Pell equation x^2 - 2*(n*y)^2 = 1, is the smallest solution of x^2 - 2*y^2 = 1 satisfying y == 0 (mod n).
If n is prime (i.e., n in A000040) then a(n) divides (n - Legendre symbol (n/2)); the Legendre symbol (n/2), or more general Kronecker symbol (n/2) is A091337(n). - A.H.M. Smeets, Jan 23 2018
From A.H.M. Smeets, Jan 23 2018: (Start)
Stronger, but conjectured:
If n is prime (i.e., in A000040) and n in {2,3,5,7,11,13,19,23} (mod 24) then (n - Legendre symbol (n/2)) / a(n) == 2 (mod 4).
If n is a safe prime (i.e., in A005385) and n in {7,23} (mod 24) then (n - Legendre symbol (n/2)) / a(n) = 2, i.e., a(n) is a Sophie Germain prime (A005384).
If n is prime (i.e., in A000040) and n in {1,17} (mod 24) then (n - Legendre symbol (n/2)) / a(n) == 0 (mod 4). (End)
REFERENCES
Michael J. Jacobson, Jr. and Hugh C. Williams, Solving the Pell Equation, Springer, 2009, pages 1-17.
LINKS
A.H.M. Smeets, Table of n, a(n) for n = 1..20000
H. W. Lenstra Jr., Solving the Pell Equation, Notices of the AMS, Vol.49, No. 2, Feb. 2002, pp. 182-192.
FORMULA
MATHEMATICA
b[n_] := b[n] = Switch[n, 0, 0, 1, 2, _, 6 b[n - 1] - b[n - 2]];
a[n_] := For[k = 1, True, k++, If[Mod[b[k], n] == 0, Return[k]]];
a /@ Range[100] (* Jean-François Alcover, Nov 16 2019 *)
PROG
(Python)
xf, yf = 3, 2
x, n = 2*xf, 0
while n < 20000:
n = n+1
y1, y0, i = 0, yf, 1
while y0%n != 0:
y1, y0, i = y0, x*y0-y1, i+1
print(n, i)
CROSSREFS
KEYWORD
nonn
AUTHOR
A.H.M. Smeets, Jan 15 2018
STATUS
approved