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.

Previous Showing 11-20 of 135 results. Next

A096491 a(n) = sqrt(n) of n if n is a perfect square, otherwise a(n) = largest term in period of continued fraction expansion of square root of n.

Original entry on oeis.org

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

Views

Author

Labos Elemer, Jun 29 2004

Keywords

Examples

			For n=127: the period={3,1,2,2,7,11,7,2,2,1,3,22}, max=a(127)=22.
		

Crossrefs

Programs

  • Maple
    A096491 := proc(n)
    if issqr(n) then
    sqrt(n) ;
    else
    numtheory[cfrac](sqrt(n),'periodic','quotients') ;
    %[2] ;
    max(op(%)) ;
    end if;
    end proc:
    # R. J. Mathar, Mar 18 2010
  • Mathematica
    u=1;Do[s=Max[Last[ContinuedFraction[n^(1/2)]]];tc[[u]]=s;u=u+1, {n, 1, m}]

Extensions

Definition revised by N. J. A. Sloane, Mar 18 2010

A035015 Period of continued fraction for square root of n-th squarefree integer.

Original entry on oeis.org

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

Views

Author

David L. Treumann (alewifepurswest(AT)yahoo.com)

Keywords

Comments

Friesen proved that each value appears infinitely often. - Michel Marcus, Apr 12 2019

Examples

			a(2)=1 because 2 is the 2nd smallest squarefree integer and sqrt 2 = [ 1,2,2,2,2,... ] thus has an eventual period of 1.
		

Crossrefs

Cf. A003285, A005117 (squarefree numbers), A013943.

Programs

  • Maple
    sqf:= select(numtheory:-issqrfree,[$2..1000]):
    map(n->nops(numtheory:-cfrac(sqrt(n),'periodic','quotients')[2]),sqf); # Robert Israel, Dec 21 2014
  • Mathematica
    Length[ContinuedFraction[Sqrt[#]][[2]]]&/@Select[ Range[ 2,200], SquareFreeQ] (* Harvey P. Dale, Jul 17 2011 *)

Formula

a(n) = A003285(A005117(n)). - Michel Marcus, Dec 29 2014

Extensions

Corrected and extended by James Sellers

A059866 Period of the continued fraction for sqrt(2^n-1).

Original entry on oeis.org

2, 4, 2, 8, 2, 12, 2, 20, 2, 12, 2, 164, 2, 40, 2, 40, 2, 1208, 2, 660, 2, 1304, 2, 3056, 2, 2492, 2, 1080, 2, 13004, 2, 10232, 2, 11296, 2, 148736, 2, 56576, 2, 615482, 2, 44448, 2, 64, 2, 2628524, 2, 28219952, 2, 139558, 2, 3067080, 2, 2683626, 2, 90740360, 2, 103050292, 2
Offset: 2

Views

Author

Labos Elemer, Feb 28 2001

Keywords

Examples

			For n=7 and n=8 the continued fractions are [[11], [3, 1, 2, 2, 7, 11, 7, 2, 2, 1, 3, 22]] and [[15], [1, 30]] with periods 12 and 2, respectively.
		

Crossrefs

Programs

  • Maple
    with(numtheory): [seq(nops(cfrac(sqrt(2^k-1),'periodic','quotients')[2]),k=2..30)];
  • Mathematica
    Table[Length@ Last@ ContinuedFraction[Sqrt[2^n - 1]], {n, 2, 56}] (* Michael De Vlieger, Mar 21 2015 *)

Extensions

Corrected and extended by Naohiro Nomoto, Nov 09 2001
a(57)-a(60) from Daniel Suteu, Jan 25 2019

A097853 Period of continued fraction for square root of n (or 1 if n is a square).

Original entry on oeis.org

1, 1, 2, 1, 1, 2, 4, 2, 1, 1, 2, 2, 5, 4, 2, 1, 1, 2, 6, 2, 6, 6, 4, 2, 1, 1, 2, 4, 5, 2, 8, 4, 4, 4, 2, 1, 1, 2, 2, 2, 3, 2, 10, 8, 6, 12, 4, 2, 1, 1, 2, 6, 5, 6, 4, 2, 6, 7, 6, 4, 11, 4, 2, 1, 1, 2, 10, 2, 8, 6, 8, 2, 7, 5, 4, 12, 6, 4, 4, 2, 1, 1, 2, 2, 5, 10, 2, 6, 5, 2, 8, 8, 10, 16, 4, 4, 11, 4, 2, 1, 1, 2, 12
Offset: 1

Views

Author

N. J. A. Sloane, Sep 01 2004

Keywords

Examples

			1 is a square. 2 has continued fraction [1;2,2,2...], 3 has [1;1,2,1,2,1,2...]. - _Georg Fischer_, Jun 14 2019
		

Crossrefs

See A003285, which is the main entry for this sequence.

Programs

  • Maple
    a:= n-> `if`(issqr(n), 1, nops(numtheory[cfrac](
             sqrt(n), 'periodic', 'quotients')[2])):
    seq(a(n), n=1..120);  # Alois P. Heinz, Jun 14 2019
  • Mathematica
    a[n_] := If[IntegerQ[Sqrt[n]], 1, Length[ContinuedFraction[Sqrt[n]][[2]]]];
    Table[a[n], {n, 1, 103}] (* Jean-François Alcover, Jan 09 2025 *)

A013644 Numbers k such that the continued fraction for sqrt(k) has period 4.

Original entry on oeis.org

7, 14, 23, 28, 32, 33, 34, 47, 55, 60, 62, 75, 78, 79, 95, 96, 98, 119, 126, 128, 136, 138, 140, 141, 142, 155, 167, 174, 176, 180, 189, 192, 194, 215, 219, 220, 222, 223, 248, 252, 254, 266, 287, 299, 300, 305, 312, 315, 318, 320, 321, 322, 335, 359, 368, 377, 390, 392
Offset: 1

Views

Author

Keywords

Examples

			The continued fraction for sqrt(7) is [2;1,1,1,4,...] with period 4, so 7 is in the sequence.  The continued fractions sqrt(3) = [1;1,2,...] with period 2 and sqrt(13) = [3;1,1,1,1,6,...] with period 5 do not have period 4, so 3 and 13 are not in the sequence. - _Michael B. Porter_, Sep 20 2016
		

References

  • Kenneth H. Rosen, Elementary Number Theory and Its Applications, Addison-Wesley, 1984, page 426 (but beware of errors!).

Crossrefs

Cf. A003285.

Programs

  • Mathematica
    cfp4Q[n_]:=Module[{sr=Sqrt[n]},!IntegerQ[sr]&&Length[ ContinuedFraction[ sr][[2]]]==4]; Select[Range[500],cfp4Q] (* Harvey P. Dale, Jul 29 2014 *)

Formula

See Austin Mack and Timothy Sawicki(2012).

A013645 Values of k at which the period of the continued fraction for sqrt(k) sets a new record.

Original entry on oeis.org

1, 2, 3, 7, 13, 19, 31, 43, 46, 94, 139, 151, 166, 211, 331, 421, 526, 571, 604, 631, 751, 886, 919, 1291, 1324, 1366, 1516, 1621, 1726, 2011, 2311, 2566, 2671, 3004, 3019, 3334, 3691, 3931, 4174, 4846, 5119, 6211, 6451, 6679, 6694, 7606, 8254, 8779, 8941, 9739
Offset: 1

Views

Author

Keywords

Comments

Periods of the fractions (sequence offset by one term) are given by A020640.
For n = 1 to 513 (the range of the b-file), the class number of the field Q(sqrt(a(n))) is 1 (computed with Mathematica). - Emmanuel Vantieghem, Mar 16 2017

Examples

			The continued fraction for sqrt(31) is {5; 1, 1, 3, 5, 3, 1, 1, 10}, the continued fraction for sqrt(43) is {6; 1, 1, 3, 1, 5, 1, 3, 1, 1, 12}, and there is no number between 31 and 43 whose square root produces a continued fraction whose period exceeds that of 31.
		

References

  • Kenneth H. Rosen, Elementary Number Theory and Its Applications, Addison-Wesley, 1984, page 426 (but beware of errors!).

Crossrefs

Programs

  • Mathematica
    mx = -1; t = {}; Do[len = Length[ Last[ ContinuedFraction[ Sqrt[ n]]]]; If[len > mx, mx = len; AppendTo[t, n]], {n, 10^4}]; t

Extensions

More terms from David W. Wilson

A020439 Numbers k such that the continued fraction for sqrt(k) has period 100.

Original entry on oeis.org

2629, 3646, 4924, 5692, 5833, 5836, 6172, 6703, 6801, 7389, 7438, 8158, 8287, 8551, 8654, 9103, 10041, 10079, 10096, 10629, 10936, 11038, 11068, 11116, 11335, 11383, 11519, 11824, 11863, 11995, 12016, 12044, 12494, 12751, 12811, 12895, 13372, 13569
Offset: 1

Views

Author

Keywords

Crossrefs

Cf. A003285.

Programs

  • Mathematica
    nn=15000;With[{nonsq=Complement[Range[nn],Range[ Floor[Sqrt[nn]]]^2]}, Select[ nonsq,Length[ ContinuedFraction[Sqrt[#]][[2]]]==100&]] (* Harvey P. Dale, May 22 2012 *)

A059926 Length of period of the continued fraction expansion of sqrt(2^n+1).

Original entry on oeis.org

1, 4, 1, 10, 1, 16, 1, 44, 1, 74, 1, 46, 1, 204, 1, 714, 1, 702, 1, 908, 1, 404, 1, 7754, 1, 1136, 1, 9886, 1, 8154, 1, 23578, 1, 65096, 1, 404762, 1, 23992, 1, 3514774, 1, 110124, 1, 4802160, 1, 6490450, 1, 180832, 1, 115972, 1, 770304, 1, 62665998, 1, 133093360, 1, 1019300318, 1, 60079334
Offset: 4

Views

Author

Labos Elemer, Mar 01 2001

Keywords

Comments

For n=1,2 a(1)=2, a(2)=1; for n=3 it is not a quadratic surd.

Examples

			For n=7 and n=8 the periods after the transient are as follows: cfrac(sqrt(2^7+1),'periodic','quotients'); gives [[11], [2, 1, 3, 1, 6, 1, 3, 1, 2, 22]] cfrac(sqrt(2^8+1),'periodic','quotients'); gives [[16], [32]]
		

Crossrefs

Programs

  • Maple
    with(numtheory): [seq(nops(cfrac(sqrt(2^k+1),'periodic','quotients')[2]),k=4..28)];
  • Mathematica
    Table[Length[ContinuedFraction[Sqrt[2^n+1]][[2]]],{n,4,60}] (* Harvey P. Dale, Feb 05 2012 *)

Formula

a(n) = A003285(A000051(n)). - Michel Marcus, Sep 27 2019

Extensions

Two more terms from David W. Wilson, Jun 18 2001
Corrected and extended by Naohiro Nomoto, Nov 09 2001
a(58)-a(63) from Daniel Suteu, Jan 25 2019

A059927 Period of the continued fraction for sqrt(2^(2n+1)).

Original entry on oeis.org

1, 2, 4, 4, 12, 24, 48, 96, 196, 368, 760, 1524, 3064, 6068, 12168, 24360, 48668, 97160, 194952, 389416, 778832, 1557780, 3116216, 6229836, 12462296, 24923320, 49849604, 99694536, 199394616, 398783628, 797556364, 1595117676, 3190297400, 6380517544, 12761088588, 25522110948, 51044281208, 102088450460, 204177067944, 408353857832, 816708255152
Offset: 0

Views

Author

Labos Elemer, Mar 01 2001

Keywords

Comments

K. R. Matthews (Feb 2007) showed that lim_{n -> oo} a(n)/2^n = 0.7427.... - A.H.M. Smeets, Nov 14 2017

Examples

			For n=5 we look at the square root of 2^11 = 2048, and find that the cycle has length 24. Here is Maple's calculation:  cfrac(sqrt(2048),'periodic','quotients') = [[45],[3,1,12,5,1,1,2,1,2,4,1,21,1,4,2,1,2,1,1,5,12,1,3,90]], the periodic part having length 24.
		

Crossrefs

Cf. A003285, A004171, A059866 (for sqrt(2^n-1)).
Cf. A064932 (for sqrt(3^(2n+1))), A293028 (for sqrt(5^(2n+1))).

Programs

  • Maple
    with(numtheory): [seq(nops(cfrac(sqrt(2^(2*k-1)),'periodic','quotients')[2]),k=1..15)];
  • Mathematica
    Array[Length@ ContinuedFraction[Sqrt[2^(2 # + 1)]][[-1]] &, 15, 0] (* Michael De Vlieger, Oct 09 2017 *)

Formula

a(n) = A003285(A004171(n)). - Michel Marcus, Sep 27 2019

Extensions

More terms from Don Reble, Oct 31 2001
a(32) = 3190297400 from Don Reble, Feb 10 2007
a(33)-a(35) from Keith Matthews (keithmatt(AT)gmail.com), Feb 16 2007, Feb 28 2007
Name clarified by Joerg Arndt, Oct 09 2017
a(36)-a(37) from Chai Wah Wu, Sep 26 2019
a(38)-a(40) from Chai Wah Wu, Sep 30 2019

A067280 Number of terms in continued fraction for sqrt(n), excl. 2nd and higher periods.

Original entry on oeis.org

1, 2, 3, 1, 2, 3, 5, 3, 1, 2, 3, 3, 6, 5, 3, 1, 2, 3, 7, 3, 7, 7, 5, 3, 1, 2, 3, 5, 6, 3, 9, 5, 5, 5, 3, 1, 2, 3, 3, 3, 4, 3, 11, 9, 7, 13, 5, 3, 1, 2, 3, 7, 6, 7, 5, 3, 7, 8, 7, 5, 12, 5, 3, 1, 2, 3, 11, 3, 9, 7, 9, 3, 8, 6, 5, 13, 7, 5, 5, 3, 1, 2, 3, 3, 6, 11, 3, 7, 6, 3, 9, 9, 11, 17, 5, 5, 12, 5
Offset: 1

Views

Author

Frank Ellermann, Feb 23 2002

Keywords

Examples

			a(2)=2: [1,(2)+ ]; a(3)=3: [1,(1,2)+ ]; a(4)=1: [2]; a(5)=2: [2,(4)+ ].
		

References

  • H. Davenport, The Higher Arithmetic. Cambridge Univ. Press, 7th edition, 1999, table 1.

Crossrefs

Related sequences: 2 : A040000, ..., 44: A040037, 48: A040041, ..., 51: A040043, 56: A040048, 60: A040052, 63: A040055, ..., 66: A040057. 68: A040059, 72: A040063, 80: A040071.
Related sequences: 45: A010135, ..., 47: A010137, 52: A010138, ..., 55: A010141, 57: A010142, ..., 59: A010144. 61: A010145, 62: A010146. 67: A010147, 69: A010148, ..., 71: A010150.
Cf. A003285.

Programs

  • Python
    from sympy import continued_fraction_periodic
    def A067280(n): return len((a := continued_fraction_periodic(0,1,n))[:1]+(a[1] if a[1:] else [])) # Chai Wah Wu, Jun 14 2022

Formula

a(n) = A003285(n) + 1. - Andrey Zabolotskiy, Jun 23 2020

Extensions

Name clarified by Michel Marcus, Jun 22 2020
Previous Showing 11-20 of 135 results. Next