OFFSET
1,3
LINKS
Ray Chandler, Table of n, a(n) for n = 1..10000
K. Lakshmi and R. Someshwari, On The Negative Pell Equation y^2 = 72x^2 - 23, International Journal of Emerging Technologies in Engineering Research (IJETER), Volume 4, Issue 7, July (2016).
R. Suganya and D. Maheswari, On the Negative Pellian Equation y^2 = 110 * x^2 - 29, Journal of Mathematics and Informatics, Vol. 11 (2017), pp. 63-71.
S. Vidhyalakshmi, V. Krithika, and K. Agalya, On The Negative Pell Equation y^2 = 72x^2 - 8, International Journal of Emerging Technologies in Engineering Research (IJETER) Volume 4, Issue 2, February (2016).
EXAMPLE
a(5)=18 because A031396(5)=13, and the solution to x^2-13y^2=-1 with smallest possible x has x=18.
MAPLE
A130226 := proc(m)
local xm, x , i, xmo, y2;
xm := [] ; # x^2-m*y^2=-1 (mod m) requires x in xm[]
for x from 0 to m-1 do
if modp(x^2, m) = modp(-1, m) then
xm := [op(xm), x] ;
end if;
end do:
for i from 0 do
for xmo in xm do
x := i*m+xmo ;
y2 := (x^2+1)/m ;
if issqr(y2) then
return x ;
end if;
end do:
end do:
end proc:
L := BFILETOLIST("b031396.txt") ;
n := 1:
for m in L do
printf("%d %d\n", n, A130226(m)) ;
n := n+1 ;
end do: # R. J. Mathar, Oct 19 2014
MATHEMATICA
terms = 1000;
a031396 = Cases[Import["https://oeis.org/A031396/b031396.txt", "Table"], {_, _}][[;; terms, 2]];
sol[n_] := Solve[x > 0 && y > 0 && x^2 - n y^2 == -1, {x, y}, Integers];
a[1] = 0; a[n_] := a[n] = x /. sol[a031396[[n]]] /. C[1] -> 0 // First // Simplify // Quiet;
Table[Print[n, " ", a031396[[n]], " ", a[n]]; a[n], {n, 1, terms}] (* Jean-François Alcover, Apr 05 2020 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Colin Barker, Aug 05 2007
STATUS
approved