OFFSET
1,1
LINKS
Carlos Rivera, Problem 88. Follow-up to problem 63, The Prime Puzzles & Problems Connection.
EXAMPLE
For n = 1, 2, 3, 4, 5 solutions are (x,y) = (3, 1), (1, 0), (5, 1), (17, 3), (19, 3).
PROG
(PARI) pellsolve(n)={if(issquare(n/2), return(1), q=bnfinit('x^2-8*n, 1); i=-1; until(y&&x==floor(x)&&y==floor(y)&&x^2-8*n*y^2==1, f=lift(q.fu[1]^i); x=abs(polcoeff(f, 0)); y=abs(polcoeff(f, 1)); i++); return(x))};
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Arkadiusz Wesolowski, Dec 21 2023
STATUS
approved