login
A068717
a(n) = -1 if A067280(n) == 0 (mod 2), otherwise a(n) = A049240(n).
4
0, -1, 1, 0, -1, 1, 1, 1, 0, -1, 1, 1, -1, 1, 1, 0, -1, 1, 1, 1, 1, 1, 1, 1, 0, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 0, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 0, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 0, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 0, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1
OFFSET
1,1
COMMENTS
Previous name was: x*x - n*y*y = +-1 has infinitely many solutions in integers (x,y).
REFERENCES
H. Davenport, The Higher Arithmetic. Cambridge Univ. Press, 7th ed., 1999, table 1.
FORMULA
a(n) = -1 if A067280(n) == 0 (mod 2), otherwise a(n) = A049240(n).
EXAMPLE
a(2)= -1: x*x - 2*y*y = -1 is soluble, e.g., 7*7 - 2*5*5 = -1.
PROG
(Python)
from math import isqrt
from sympy import continued_fraction_periodic
def A068717(n): return 0 if (a:=isqrt(n)**2==n) else (-1 if len(continued_fraction_periodic(0, 1, n)[1]) & 1 else 1-int(a)) # Chai Wah Wu, Jun 14 2022
CROSSREFS
KEYWORD
sign,easy
AUTHOR
Frank Ellermann, Feb 25 2002
EXTENSIONS
New name from formula by Joerg Arndt, Aug 29 2020
STATUS
approved