A290284 Number of pairs of integers (x,y) satisfying the Diophantine equation x^2 - A000037(n)*y^2 = m such that x/y gives a convergent series towards sqrt(A000037(n)).
3, 3, 5, 4, 5, 4, 7, 6, 5, 15, 8, 5, 9, 7, 12, 6, 10, 12, 9, 6, 11, 9, 12, 21, 7, 17, 9, 10, 11, 7, 13, 10, 9, 9, 19, 8, 20, 15, 13, 24, 12, 8, 15, 12, 16, 27, 16, 13, 9, 14, 27, 17, 12
Offset: 1
Examples
For A000037(4) = 6, a(4) = 4 we have the following sequences of pairs (x,y): m = 1: x(0) = 1, x(1) = 5, x(i) = 10*x(i-1) - x(i-2) as in A001079(i) and y(0) = 0, y(1) = 2, y(i) = 10*y(i-1) - y(i-2) as in A001078(i); m = -6: x(0) = 0, x(1) = 12, x(i) = 10*x(i-1) - x(i-2) as in A004291(i) (for i > 0) and y(0) = 1, y(1) = 5, y(i) = 10*y(i-1) - y(i-2) as in A001079(i); m = -5: x(0) = 1, x(1) = 17, x(i) = 10*x(i-1) - x(i-2) and y(0) = 1, y(1) = 7, y(i) = 10*y(i-1) - y(i-2); m = -2: x(0) = 2, x(1) = 22, x(i) = 10*x(i-1) - x(i-2) and y(0) = 1, y(1) = 9, y(i) = 10*y(i-1) - y(i-2) as in A072256(i+1). In some cases a combination of A000037(n) and m has more than one integer pair sequence, for example A000037(5) = 7 and m = -3 has two integer pair sequences: x(0) = 2, x(1) = 37, x(i) = 16*x(i-1) - x(i-2) and y(0) = 1, y(1) = 14, y(i) = 16*y(i-1) - y(i-2); x(0) = -2, x(1) = 5, x(i) = 16*x(i-1) - x(i-2) and y(0) = 1, y(1) = 2, y(i) = 16*y(i-1) - y(i-2). For A000037(4) = 6, the sequence observed from x^2 - 6y^2 = 3 is not in the convergent series of sqrt(6) due to for example x1/y1 = 2643/1079 = sqrt(6) + 5.259842e-7 while the smaller x,y pair, x2/y2 = 2158/881 from x^2 - 6y^2 = -2 is a fraction closer to sqrt(5), 2158/881 = sqrt(6) - 5.259841e-7.
Programs
-
Python
from fractions import Fraction def FracSqrt(p): a = Fraction(p/1) b = Fraction(1/1) e = Fraction(10**(-200)) while a-b > e: a = (a+b)/2 b = p/a return a print("number: ") pp = int(input()) p = FracSqrt(pp) n = 0 while n >= 0: n = n+1 q = p.limit_denominator(n) if (n == 1) or (q != q0): t = q*n m = t*t-pp*n*n print(n,q,m) q0 = q
Comments