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.

A320773 Numbers (excluding squares) whose square root has a continued fraction with a period < 3.

Original entry on oeis.org

2, 3, 5, 6, 8, 10, 11, 12, 15, 17, 18, 20, 24, 26, 27, 30, 35, 37, 38, 39, 40, 42, 48, 50, 51, 56, 63, 65, 66, 68, 72, 80, 82, 83, 84, 87, 90, 99, 101, 102, 104, 105, 110, 120, 122, 123, 132, 143, 145, 146, 147, 148, 150, 152, 156, 168, 170, 171, 182, 195, 197, 198, 200
Offset: 1

Views

Author

Paul Weisenhorn, Oct 21 2018

Keywords

Comments

The Heron sequence of every number a(n) has the following relationship: numerator(h(k))^2 - a(n)*denominator(h(k))^2 = 1 for k > 1.
The Heron sequence of every number a(n) has the following relationship with the continued fraction f(s) convergent to sqrt(a(n)): h(k) = f(2^k-1).
From Gerhard Kirchner, Jan 17 2020: (Start)
Numbers k = m^2 + r with m > 0 and 0 < r <= 2m such that r is a divisor of 2m.
Continued fraction: k = [m; 2m/r, 2m, 2m/r, 2m, ...].
The number of terms that are between m^2 and (m+1)^2 is equal to the number of divisors of 2m, which is A099777(m).
Proof see link. The Maxima code below demonstrates the divisor property. Note that there is no divisor of 2m between m and 2m.
(End)

Examples

			The continued fraction of sqrt(6) = 2 + 1/(2 + 1/(4 + 1/(2 + 1/(4 + 1/(2 + 1/(4 + ...)))))) = [2; 2, 4, 2, 4, 2, 4, ...] has repeating portion (2, 4) with period 2, so 6 is a term.
		

Programs

  • Maple
    Digits:=40: nr:=0:
    for z from 2 to 200 do
      test:=true: c:=sqrt(z):
      if (c=floor(c)) the test:=false: end if:
      while (test=true) do
        b[0]:=floor(c):
        r[0]:=c:
        for k from 1 to 2 do
          r[k]:=evalf(1/(r[k-1]-b[k-1])):
          b[k]:=floor(r[k]):
        end do:
        if (b[1]=2*b[0]) or (b[2]=2*b[0]) then nr:=nr+1: a[nr]:=z: printf("%4d",z): end if:
        test:=false:
      end do:
    end do:
  • Mathematica
    Select[Range[200], !IntegerQ[Sqrt[#]] && Length@ContinuedFraction[Sqrt[#]][[-1]]<3 &] (* Amiram Eldar, Nov 01 2018 *)
  • Maxima
    block([n: 2, m: 0, r: 0, k: 0, kmax: 10,v: ""],
      while kGerhard Kirchner, Jan 17 2020 */

Extensions

Edited by Jon E. Schoenfield, Oct 19 2019