cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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)).

Original entry on oeis.org

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

Views

Author

A.H.M. Smeets, Jul 25 2017

Keywords

Comments

If (x(0),y(0)) and (x(1),y(1)) are solutions of the Diophantine equation x^2 - A000037(n)*y^2 = m, then (x(i),y(i)) with x(i) = A*x(i-1) - x(i-2) and y(i) = A*y(i-1) - y(i-2) are also solutions for i > 1. The sequence represents the number of different integer pair sequences where in all cases A = 2*A033313(A000037(n)). Each contributing sequences has to satisfy the condition that for all x < x(i) and all y < y(i), |x/y - sqrt(A000037(n))| > |x(i)/y(i) - sqrt(A000037(n))|.
a(A000037(n)) is not equal to the number of all sequences of pairs (x(i),y(i)) that are solutions of a Diophantine equation x^2 - D*y^2 = m, with -D <= m < D and D = A000037(n). For example for D = 5 we obtain two other sequences from Fibonacci sequence: (first) x(i) = 2*Fib(6i)-Fib(6i-1) and y(i) = Fib(6i-1) satisfy x^2 - D*y^2 = -4 and (second) x(i) = 2*Fib(6i+3) - Fib(6i+2) and y(i) = Fib(6i+2) satisfy x^2 - D*y^2 = 4; but neither of these satisfy the restriction that, for all x < x(i) and all y < y(i), |x/y - sqrt(D)| > |x(i)/y(i) - sqrt(D)|.
A good approximation for the order of magnitude of a(n) is given by 2*log(2*A033313(n)).
For a lower bound, all values m satisfying either m = -D + k^2 for k^2 < D or m = 1, D = A000037(n), contribute with a sequence to the convergent series of sqrt(D), so a(n) > floor(sqrt(D)) + 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.
		

Crossrefs

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