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.

Showing 1-2 of 2 results.

A288184 Least odd number k such that the continued fraction for sqrt(k) has period n.

Original entry on oeis.org

5, 3, 41, 7, 13, 19, 73, 31, 113, 43, 61, 103, 193, 179, 109, 133, 157, 139, 337, 151, 181, 253, 853, 271, 457, 211, 949, 487, 821, 379, 601, 463, 613, 331, 1061, 1177, 421, 619, 541, 589, 1117, 571, 1153, 823, 1249, 739, 1069, 631, 1021, 1051, 1201, 751
Offset: 1

Views

Author

Ilya Gutkovskiy, Jun 06 2017

Keywords

Examples

			a(2) = 3, sqrt(3) = 1 + 1/(1 + 1/(2 + 1/(1 + 1/(2 + 1/...)))), period 2: [1, 2].
		

Crossrefs

Programs

  • Python
    from sympy import continued_fraction_periodic
    def A288184(n):
        d = 1
        while True:
            s = continued_fraction_periodic(0,1,d)[-1]
            if isinstance(s, list) and len(s) == n:
                return d
            d += 2 # Chai Wah Wu, Jun 07 2017

Formula

A003285(a(n)) = n, A000035(a(n)) = 1.

A338785 a(n) is the least number k such that continued fraction for sqrt(prime(k)) has period n.

Original entry on oeis.org

1, 2, 13, 4, 6, 8, 21, 11, 30, 14, 18, 27, 44, 41, 29, 43, 37, 34, 68, 36, 42, 94, 147, 58, 88, 47, 186, 93, 142, 75, 110, 90, 112, 67, 178, 228, 82, 114, 100, 222, 187, 105, 191, 143, 204, 131, 180, 115, 172, 177, 197, 133, 263, 272, 353, 175, 231, 242, 322, 157
Offset: 1

Views

Author

Ilya Gutkovskiy, Nov 08 2020

Keywords

Examples

			sqrt(prime(1))  = sqrt(2)  = 1 + 1/(2 + 1/(2 + ...)), period 1.
sqrt(prime(2))  = sqrt(3)  = 1 + 1/(1 + 1/(2 + 1/(1 + 1/(2 + ...)))), period 2.
sqrt(prime(13)) = sqrt(41) = 6 + 1/(2 + 1/(2 + 1/(12 + 1/(2 + 1/(2 + 1/(12 + ...)))))), period 3.
		

Crossrefs

Programs

  • Maple
    N:= 100: # for a(1)..a(N)
    A:= Vector(N): count:= 0: p:= 1:
    for n from 1 while count < N do
      p:= nextprime(p);
      v:= nops(numtheory:-cfrac(sqrt(p),periodic,quotients)[2]);
      if v <= N and A[v] = 0 then count:= count+1; A[v]:= n; fi
    od:
    convert(A,list); # Robert Israel, Nov 11 2020
  • Mathematica
    Table[SelectFirst[Range[500], Length[Last[ContinuedFraction[Sqrt[Prime[#]]]]] == n &], {n, 60}]

Formula

a(n) = A000720(A059800(n)).
Showing 1-2 of 2 results.