A068717 a(n) = -1 if A067280(n) == 0 (mod 2), otherwise a(n) = A049240(n).
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
Examples
a(2)= -1: x*x - 2*y*y = -1 is soluble, e.g., 7*7 - 2*5*5 = -1.
References
- H. Davenport, The Higher Arithmetic. Cambridge Univ. Press, 7th ed., 1999, table 1.
Links
- John Robertson, Solving the generalized Pell equation x^2-dy^2=N.
Programs
-
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
Extensions
New name from formula by Joerg Arndt, Aug 29 2020
Comments