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-4 of 4 results.

A117767 a(n) is the difference between the smallest square greater than prime(n) and the largest square less than prime(n), where prime(n) = A000040(n) is the n-th prime number.

Original entry on oeis.org

3, 3, 5, 5, 7, 7, 9, 9, 9, 11, 11, 13, 13, 13, 13, 15, 15, 15, 17, 17, 17, 17, 19, 19, 19, 21, 21, 21, 21, 21, 23, 23, 23, 23, 25, 25, 25, 25, 25, 27, 27, 27, 27, 27, 29, 29, 29, 29, 31, 31, 31, 31, 31, 31, 33, 33, 33, 33, 33, 33, 33, 35, 35, 35, 35, 35, 37, 37, 37, 37, 37, 37
Offset: 1

Views

Author

Odimar Fabeny, Apr 15 2006

Keywords

Comments

From Reinhard Zumkeller, Sep 20 2014: (Start)
a(n) <= floor(2*sqrt(prime(n))) + 1 = A247485(n).
a(A247514(n)) = A247485(A247514(n)).
a(A247515(n)) < A247485(A247515(n)). (End)

Examples

			The 7th prime number is 17, which is between the consecutive squares 16 and 25, so a(7) = 25 - 16 = 9.
		

Crossrefs

Programs

  • Haskell
    a117767 = (+ 1) . (* 2) . a000006  -- Reinhard Zumkeller, Sep 20 2014
  • Mathematica
    a[n_]:=2Floor[Sqrt[Prime[n]]]+1
  • PARI
    { forprime(p=2,200, f = floor(sqrt(p)) ; print1(2*f+1,",") ; ) ; } \\ R. J. Mathar, Apr 21 2006
    

Formula

a(n) = 2*A000006(n) + 1.
a(n) = 2*floor(sqrt(prime(n))) + 1. - R. J. Mathar, Apr 21 2006

Extensions

More terms from R. J. Mathar, Apr 21 2006
Edited by Dean Hickerson, Jun 03 2006

A096495 Number of distinct terms in the periodic part of the continued fraction for sqrt(prime(n)).

Original entry on oeis.org

1, 2, 1, 2, 2, 2, 1, 4, 3, 3, 4, 1, 2, 4, 3, 3, 4, 5, 5, 4, 3, 3, 2, 3, 3, 1, 5, 4, 6, 3, 6, 4, 3, 6, 5, 7, 5, 6, 3, 3, 6, 6, 6, 5, 1, 7, 8, 3, 2, 3, 3, 6, 5, 5, 1, 4, 2, 7, 7, 5, 6, 3, 6, 6, 6, 5, 8, 6, 5, 4, 4, 3, 7, 3, 9, 4, 3, 7, 1, 6, 6, 8, 7, 6, 3, 2, 5, 7, 5, 9, 4, 6, 9, 8, 4, 4, 6, 6, 8, 9, 8, 2, 4, 6, 10
Offset: 1

Views

Author

Labos Elemer, Jun 29 2004

Keywords

Examples

			n = 31: prime(31) = 127, and the periodic part is {3,1,2,2,7,11,7,2,2,1,3,22}, so a(31) = 6.
		

Crossrefs

Programs

  • Mathematica
    {te=Table[0, {m}], u=1}; Do[s=Length[Union[Last[ContinuedFraction[Prime[n]^(1/2)]]]]; te[[u]]=s;u=u+1, {n, 1, m}];te
    Table[Length[Union[ContinuedFraction[Sqrt[Prime[n]]][[2]]]],{n,110}] (* Harvey P. Dale, Jun 22 2017 *)

Formula

a(n) = A028832(A000040(n)). - Amiram Eldar, Nov 10 2021

A096496 Number of distinct primes in the periodic part of the continued fraction for sqrt(prime(n)).

Original entry on oeis.org

1, 1, 0, 0, 1, 0, 0, 2, 1, 1, 2, 0, 1, 2, 1, 1, 2, 2, 3, 2, 1, 1, 0, 2, 1, 0, 1, 1, 2, 1, 4, 2, 1, 4, 2, 4, 3, 4, 1, 0, 4, 1, 3, 2, 0, 3, 4, 1, 0, 1, 1, 2, 2, 2, 0, 0, 1, 1, 3, 1, 1, 0, 4, 3, 3, 1, 5, 3, 2, 2, 2, 1, 3, 2, 4, 2, 1, 2, 0, 3, 4, 5, 5, 3, 1, 0, 3, 4, 1, 4, 1, 3, 3, 2, 1, 1, 2, 2, 2, 4, 4, 0, 2, 3, 4
Offset: 1

Views

Author

Labos Elemer, Jun 29 2004

Keywords

Examples

			n=31: prime(31) = 127, and the periodic part of the continued fraction of sqrt(127) is {3,1,2,2,7,11,7,2,2,1,3,22}, so a(31) = 4.
		

Crossrefs

Programs

  • Mathematica
    {te=Table[0, {m}], u=1}; Do[s=Count[PrimeQ[Union[Last[ContinuedFraction[f[n]^(1/2)]]]], True]; te[[u]]=s;u=u+1, {n, 1, m}];te
    Count[Union[ContinuedFraction[Sqrt[#]][[2]]],?PrimeQ]&/@Prime[ Range[ 110]] (* _Harvey P. Dale, Apr 27 2016 *)

A308720 The maximum value in the continued fraction of sqrt(n), or 0 if there is no fractional part.

Original entry on oeis.org

0, 0, 2, 2, 0, 4, 4, 4, 4, 0, 6, 6, 6, 6, 6, 6, 0, 8, 8, 8, 8, 8, 8, 8, 8, 0, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 0, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 16, 16, 16, 16, 16, 16, 16
Offset: 0

Views

Author

Karl Fischer, Jun 19 2019

Keywords

Comments

The continued fraction expansion of sqrt(n) is periodic, and the maximal element is the last element in the period, 2*floor(sqrt(n)).

Crossrefs

Programs

  • Mathematica
    {0} ~Join~ Table[2 Mod[Floor@ Sqrt@ n, Ceiling@ Sqrt@ n], {n, 100}] (* Giovanni Resta, Jun 29 2019 *)

Formula

a(k^2) = 0.
a(m) = 2 * floor(sqrt(m)) for nonsquare m.
a(n) = 2 * A320471(n) for n > 0.

Extensions

More terms from Giovanni Resta, Jun 29 2019
Showing 1-4 of 4 results.