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

A096493 Number of distinct primes in continued fraction period of square root of n.

Original entry on oeis.org

0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 2, 1, 1, 1, 1, 0, 0, 0, 1, 2, 1, 1, 2, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 1, 1, 2, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 2, 1, 2, 0, 0, 0, 0, 0, 3, 0, 1, 1, 2, 1, 1, 0, 0, 2, 2, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 1, 1, 1, 0, 3, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0
Offset: 1

Views

Author

Labos Elemer, Jun 29 2004

Keywords

Examples

			n=127: the period={3,1,2,2,7,11,7,2,2,1,3,22},
distinct-primes={2,3,7,11}, so a[127]=4;
		

Crossrefs

Programs

  • Mathematica
    {te=Table[0, {m}], u=1}; Do[s=Count[PrimeQ[Union[Last[ContinuedFraction[n^(1/2)]]]], True]; te[[u]]=s;u=u+1, {n, 1, m}];te
    dpcf[n_]:=Module[{s=Sqrt[n]},If[IntegerQ[s],0,Count[Union[ ContinuedFraction[ s][[2]]],?PrimeQ]]]; Array[dpcf,110] (* _Harvey P. Dale, Mar 18 2016 *)

A096494 Largest value in the periodic part of the continued fraction of sqrt(prime(n)).

Original entry on oeis.org

2, 2, 4, 4, 6, 6, 8, 8, 8, 10, 10, 12, 12, 12, 12, 14, 14, 14, 16, 16, 16, 16, 18, 18, 18, 20, 20, 20, 20, 20, 22, 22, 22, 22, 24, 24, 24, 24, 24, 26, 26, 26, 26, 26, 28, 28, 28, 28, 30, 30, 30, 30, 30, 30, 32, 32, 32, 32, 32, 32, 32, 34, 34, 34, 34, 34, 36, 36, 36, 36, 36, 36
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)=22.
		

Crossrefs

Programs

  • Haskell
    a096494 = (* 2) . a000006  -- Reinhard Zumkeller, Sep 20 2014
  • Maple
    A096491 := proc(n)
    if issqr(n) then
    sqrt(n) ;
    else
    numtheory[cfrac](sqrt(n),'periodic','quotients') ;
    %[2] ;
    max(op(%)) ;
    end if;
    end proc:
    A096494 := proc(n)
    option remember ;
    A096491(ithprime(n)) ;
    end proc: # R. J. Mathar, Mar 18 2010
  • Mathematica
    {te=Table[0, {m}], u=1}; Do[s=Max[Last[ContinuedFraction[Prime[n]^(1/2)]]]; te[[u]]=s;u=u+1, {n, 1, m}];te
    a[n_]:=IntegerPart[Sqrt[Prime[n]]] 2 IntegerPart[Sqrt[#]]&/@Prime[Range[90]] (* Vincenzo Librandi, Aug 09 2015 *)

Formula

It seems that lim_{n->infinity} a(n)/n = 0. - Benoit Cloitre, Apr 19 2003
a(n) = 2*A000006(n). - Benoit Cloitre, Apr 19 2003

A096492 Number of distinct terms in continued fraction period of square root of n.

Original entry on oeis.org

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

Views

Author

Labos Elemer, Jun 29 2004

Keywords

Comments

Essentially the same as A028832. - Amiram Eldar, Nov 10 2021

Examples

			n=127: the period={3,1,2,2,7,11,7,2,2,1,3,22},distinct-terms={1,2,3,7,11,22}, so a[127]=6;
		

Crossrefs

Programs

  • Mathematica
    {tc=Table[0, {m}], u=1}; Do[s=Length[Union[Last[ContinuedFraction[n^(1/2)]]]]; tc[[u]]=s;u=u+1, {n, 1, m}], tc

Formula

a(n) = 1 if n is a square and a(n) = A028832(n) otherwise. - Amiram Eldar, Nov 10 2021

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

A276689 Least term in the periodic part of the continued fraction expansion of sqrt(n) or 0 if n is square.

Original entry on oeis.org

0, 0, 2, 1, 0, 4, 2, 1, 1, 0, 6, 3, 2, 1, 1, 1, 0, 8, 4, 1, 2, 1, 1, 1, 1, 0, 10, 5, 2, 1, 2, 1, 1, 1, 1, 1, 0, 12, 6, 4, 3, 2, 2, 1, 1, 1, 1, 1, 1, 0, 14, 7, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 0, 16, 8, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 0, 18, 9, 6, 1
Offset: 0

Views

Author

Chai Wah Wu, Sep 28 2016

Keywords

Comments

If r > 0 is even, then a((rm/2)^2+m) = r for all m >= 1 and a((r^2-2)^2/4 + (r+1)^3) = r.
If r is odd, then a((rm)^2+2m) = r for all m >= 1 and a(r^4 + r^3 + 5(r+1)^2/4) = r.

Crossrefs

Programs

  • Python
    from sympy import continued_fraction_periodic
    def A276689(n):
        x = continued_fraction_periodic(0,1,n)
        return min(x[1]) if len(x) > 1 else 0
Showing 1-6 of 6 results.