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-10 of 135 results. Next

A061490 Smallest number which when iterated n times under A003285 gives a square.

Original entry on oeis.org

1, 2, 3, 19, 166, 8269, 11568181
Offset: 0

Views

Author

Naohiro Nomoto, Nov 08 2001

Keywords

Comments

Smallest m such that A003285(A003285(..(m))) = square with n iterations.

Examples

			A003285(A003285(3))=1, 3 is the smallest number requiring 2 iterations to reach a square number, so a(2)=3.
		

Crossrefs

Cf. A003285.

Extensions

a(6) from Sean A. Irvine, Feb 18 2023

A065129 a(n) is the least m such that m/A003285(m) = n, or 0 if no such m exists.

Original entry on oeis.org

0, 2, 6, 8, 5, 12, 28, 32, 18, 10, 0, 24, 0, 0, 30, 0, 17, 0, 38, 40, 42, 0, 276, 48, 125, 26, 0, 56, 406, 0, 496, 128, 66, 68, 140, 72, 37, 0, 0, 80, 0, 84, 0, 176, 90, 0, 1222, 192, 294, 50, 102, 104, 636, 432, 110, 0, 0, 928, 708, 120, 0, 248, 252, 0, 65, 132
Offset: 1

Views

Author

Naohiro Nomoto, Nov 14 2001

Keywords

Comments

Conjecture: A003285(m) = even or A004613, if m is divisible by A003285(m). [This sentence appears to be saying that all odd terms of this sequence are in A004613.]
Because A003285(m) < 3.76*sqrt(m)*log(m) (see Stanton et al.), it is enough to check m such that m <= (3.76*n*log(m))^2. For n <= 36 it even suffices to check m <= 5916*n. - Nathaniel Johnston, May 10 2011

Crossrefs

Programs

  • Maple
    with(numtheory): A065129 := proc(n) local m: if(n=1)then return 0:fi: for m from n by n to 5916*n do if(frac(sqrt(m))<>0)then if(n*nops(cfrac(sqrt(m),'periodic','quotients')[2])=m)then return m: fi: fi: od: return 0: end: seq(A065129(n),n=1..10); # Nathaniel Johnston, May 10 2011
  • Mathematica
    Do[k = 2; While[ k / Length[ Last[ ContinuedFraction[ Sqrt[k]]]] != n, k++ ]; Print[k], {n, 2, 10} ]

Extensions

a(11)-a(37) from Nathaniel Johnston, May 10 2011
Terms a(38) and beyond from Chai Wah Wu, Jan 27 2021

A065104 Numbers k such that for no m between k^2 and (k+1)^2 - 1 is it true that A003285(m) = A003285(m+1).

Original entry on oeis.org

1, 2, 7, 13, 16, 424, 1693, 2116, 2206
Offset: 1

Views

Author

Naohiro Nomoto, Nov 20 2001

Keywords

Examples

			For n=3, m = 9,10,11,12,13,14,15, A003285(11) = A003285(12), so 3 is not in the sequence.
		

Crossrefs

A065304 Numbers k such that A003285(k) = A003285(k+1) == 1 (mod 2).

Original entry on oeis.org

19633, 24697, 63529, 92977, 115945, 139009, 147985, 157753, 203809, 229561, 389833, 676681, 679177, 744025, 775129, 793129, 884761, 932905, 933769, 1124065, 1370713, 1689409, 2137033, 2680585, 2789113, 2872537, 3117217, 3415585, 3740641, 3803497, 3809353, 3837529
Offset: 1

Views

Author

Naohiro Nomoto, Nov 22 2001

Keywords

Comments

Numbers so far are all 1 (mod 24). - Ralf Stephan, Jul 07 2003

Crossrefs

Extensions

a(22)-a(23) from Jinyuan Wang, Aug 22 2021
More terms from Sean A. Irvine, Aug 27 2023

A146326 Length of the period of the continued fraction of (1+sqrt(n))/2.

Original entry on oeis.org

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

Views

Author

Artur Jasinski, Oct 30 2008

Keywords

Comments

First occurrence of n in this sequence see A146343.
Records see A146344.
Indices where records occurred see A146345.
a(n) =0 for n = k^2 (A000290).
a(n) =1 for n = 4 k^2 + 4 k + 5 (A078370). For primes see A005473.
a(n) =2 for n in A146327. For primes see A056899.
a(n) =3 for n in A146328. For primes see A146348.
a(n) =4 for n in A146329. For primes see A028871 - {2}.
a(n) =5 for n in A146330. For primes see A146350.
a(n) =6 for n in A146331. For primes see A146351.
a(n) =7 for n in A146332. For primes see A146352.
a(n) =8 for n in A146333. For primes see A146353.
a(n) =9 for n in A143577. For primes see A146354.
a(n)=10 for n in A146334. For primes see A146355.
a(n)=11 for n in A146335. For primes see A146356.
a(n)=12 for n in A146336. For primes see A146357.
a(n)=13 for n in A333640. For primes see A146358.
a(n)=14 for n in A146337. For primes see A146359.
a(n)=15 for n in A146338. For primes see A146360.
a(n)=16 for n in A146339. For primes see A146361.
a(n)=17 for n in A146340. For primes see A146362.

Examples

			a(2) = 2 because continued fraction of (1+sqrt(2))/2 = 1, 4, 1, 4, 1, 4, 1, ... has period (1,4) length 2.
		

Crossrefs

Programs

  • Maple
    A146326 := proc(n) if not issqr(n) then numtheory[cfrac]( (1+sqrt(n))/2, 'periodic','quotients') ; nops(%[2]) ; else 0 ; fi; end: seq(A146326(n),n=1..100) ; # R. J. Mathar, Sep 06 2009
  • Mathematica
    Table[cf = ContinuedFraction[(1 + Sqrt[n])/2]; If[Head[cf[[-1]]] === List, Length[cf[[-1]]], 0], {n, 100}]
    f[n_] := Length@ ContinuedFraction[(1 + Sqrt[n])/2][[-1]]; Array[f, 100] (* Robert G. Wilson v, Apr 11 2017 *)

Formula

a(n) = 0 iff n is a square (A000290). - Robert G. Wilson v, Apr 11 2017

Extensions

a(39) and a(68) corrected by R. J. Mathar, Sep 06 2009

A054269 Length of period of continued fraction for sqrt(prime(n)).

Original entry on oeis.org

1, 2, 1, 4, 2, 5, 1, 6, 4, 5, 8, 1, 3, 10, 4, 5, 6, 11, 10, 8, 7, 4, 2, 5, 11, 1, 12, 6, 15, 9, 12, 6, 9, 18, 9, 20, 17, 18, 4, 5, 14, 21, 16, 13, 1, 20, 26, 4, 2, 5, 11, 12, 17, 14, 1, 12, 3, 24, 21, 13, 18, 5, 14, 16, 17, 11, 34, 19, 14, 7, 15, 4, 20, 5, 30, 8, 9, 21, 1, 21, 18, 37, 16
Offset: 1

Views

Author

N. J. A. Sloane, May 05 2000

Keywords

Comments

The following sequences (allowing offset of first term) all appear to have the same parity: A034953, triangular numbers with prime indices; A054269, length of period of continued fraction for sqrt(p), p prime; A082749, difference between the sum of next prime(n) natural numbers and the sum of next n primes; A006254, numbers n such that 2n-1 is prime; A067076, 2n+3 is a prime. - Jeremy Gardiner, Sep 10 2004
Note that primes of the form n^2+1 (A002496) have a continued fraction whose period length is 1; odd primes of the form n^2+2 (A056899) have length 2; odd primes of the form n^2-2 (A028871) have length 4. - T. D. Noe, Nov 03 2006
For an odd prime p, the length of the period is odd if p=1 (mod 4) or even if p=3 (mod 4). - T. D. Noe, May 22 2007

Crossrefs

Cf. A003285, A130272 (primes at which the period length sets a new record).

Programs

  • Maple
    with(numtheory): for i from 1 to 150 do cfr := cfrac(ithprime(i)^(1/2), 'periodic','quotients'); printf(`%d,`, nops(cfr[2])) od:
  • Mathematica
    Table[p=Prime[n]; Length[Last[ContinuedFraction[Sqrt[p]]]],{n,100}] (* T. D. Noe, May 22 2007 *)
    Length[ContinuedFraction[Sqrt[#]][[2]]]&/@Prime[Range[100]] (* Harvey P. Dale, Sep 28 2024 *)

Extensions

More terms from James Sellers, May 05 2000

A086594 a(n) = 8*a(n-1) + a(n-2), starting with a(0)=2 and a(1)=8.

Original entry on oeis.org

2, 8, 66, 536, 4354, 35368, 287298, 2333752, 18957314, 153992264, 1250895426, 10161155672, 82540140802, 670482282088, 5446398397506, 44241669462136, 359379754094594, 2919279702218888, 23713617371845698, 192628218676984472, 1564739366787721474
Offset: 0

Views

Author

Nikolay V. Kosinov (kosinov(AT)unitron.com.ua), Sep 11 2003

Keywords

Comments

a(n+1)/a(n) converges to 4 + sqrt(17).

Examples

			a(4) = 8*a(3)+a(2) = 8*536+66 = 4354.
		

Crossrefs

Cf. A003285.

Programs

  • Magma
    I:=[2,8]; [n le 2 select I[n] else 8*Self(n-1)+Self(n-2): n in [1..30]]; // Vincenzo Librandi, Sep 19 2016
    
  • Mathematica
    LinearRecurrence[{8,1},{2,8},30] (* Harvey P. Dale, Sep 21 2014 *)
    RecurrenceTable[{a[0] == 2, a[1] == 8, a[n] == 8 a[n-1] + a[n-2]}, a, {n, 30}] (* Vincenzo Librandi, Sep 19 2016 *)
  • PARI
    x='x+O('x^30); Vec(2*(1-4*x)/(1-8*x-x^2)) \\ G. C. Greubel, Nov 07 2018

Formula

a(n) = (4+sqrt(17))^n + (4-sqrt(17))^n.
O.g.f: 2*(-1+4*x)/(-1+8*x+x^2). - R. J. Mathar, Dec 02 2007
a(n) = 2*A088317(n). - R. J. Mathar, Sep 27 2014

A013646 Least m such that the continued fraction for sqrt(m) has period n.

Original entry on oeis.org

1, 2, 3, 41, 7, 13, 19, 58, 31, 106, 43, 61, 46, 193, 134, 109, 94, 157, 139, 337, 151, 181, 166, 586, 271, 457, 211, 949, 334, 821, 379, 601, 463, 613, 331, 1061, 478, 421, 619, 541, 526, 1117, 571, 1153, 604, 1249, 694, 1069, 631, 1021, 1051, 1201, 751, 1669, 886
Offset: 0

Views

Author

Keywords

Comments

In a search of fractions up to sqrt(1650241399), the smallest length not yet seen is 97921. The next unseen lengths are 101679, 102181 and 102407. After 145 more missing odd lengths, the first even length not seen is 107292. This would suggest that A215485 may be exclusively odd after an early 2, but beware the law of small numbers! - Patrick McKinley, Aug 24 2012
a(97921) = 1664155249, a(101679) = 1654486681, a(102181) = 1682919001, a(102407) = 1680133849, a(107292) = 1651931884, thus 107292 is not in A215485. - Chai Wah Wu, Jun 08 2017
a(999213) = 133511789629, a(1000000) = 98814608764. - Michael Hortmann, Mar 20 2023

References

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

Crossrefs

Programs

  • Mathematica
    a[n_] := Catch[For[m = 1, True, m++, If[Length[ Last[ ContinuedFraction[ Sqrt[m] ]]] == n, Print[m]; Throw[m] ]]]; Table[a[n], {n, 0, 54}](* Jean-François Alcover, May 15 2012 *)
    Flatten[Table[Position[Table[{s=Sqrt[n]};If[IntegerQ[s],0,Length[ ContinuedFraction[s] [[2]]]], {n,2000}],i,{1},1],{i,0,60}]] (* Harvey P. Dale, Sep 15 2013 *)

Formula

A003285(a(n)) = n. - Pontus von Brömssen, Nov 24 2024

A006702 Solution to a Pellian equation: least x such that x^2 - n*y^2 = +- 1.

Original entry on oeis.org

1, 1, 2, 1, 2, 5, 8, 3, 1, 3, 10, 7, 18, 15, 4, 1, 4, 17, 170, 9, 55, 197, 24, 5, 1, 5, 26, 127, 70, 11, 1520, 17, 23, 35, 6, 1, 6, 37, 25, 19, 32, 13, 3482, 199, 161, 24335, 48, 7, 1, 7, 50, 649, 182, 485, 89, 15, 151, 99, 530, 31, 29718, 63, 8, 1, 8, 65, 48842
Offset: 1

Views

Author

Keywords

Comments

When n is a square, the trivial solution x=1, y=0 is taken; otherwise we take the least x that satisfies either the +1 or -1 equation. - T. D. Noe, May 19 2007
Apparently the generating function of the sequence of the denominators of continued fraction convergents to sqrt(n) is always rational and of form p(x)/[1 - C*x^m + (-1)^m * x^(2m)], or equivalently, the denominators satisfy the linear recurrence b(n+2m) = C*b(n+m) - (-1)^m * b(n). If so, then it seems that a(n) is half the value of C for each nonsquare n, or 1. See A003285 for the conjecture regarding m. The same conjectures apply to the sequences of the numerators of continued fraction convergents to sqrt(n). - Ralf Stephan, Dec 12 2013
The conjecture is true, cf. link. - Jan Ritsema van Eck, Mar 08 2021

References

  • A. Cayley, Report of a committee appointed for the purpose of carrying on the tables connected with the Pellian equation ..., Collected Mathematical Papers. Vols. 1-13, Cambridge Univ. Press, London, 1889-1897, Vol. 13, pp. 430-443.
  • C. F. Degen, Canon Pellianus. Hafniae, Copenhagen, 1817.
  • D. H. Lehmer, Guide to Tables in the Theory of Numbers. Bulletin No. 105, National Research Council, Washington, DC, 1941, p. 55.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Mathematica
    r[x_, n_] := Reduce[y > 0 && (x^2 - n*y^2 == -1 || x^2 - n*y^2 == 1 ), y, Integers];
    a[n_ /; IntegerQ[ Sqrt[n]]] = 1;
    a[n_] := a[n] = (k = 1; While[ r[k, n] === False, k++]; k);
    Table[ Print[ a[n] ]; a[n], {n, 1, 67}] (* Jean-François Alcover, Jan 30 2012 *)
    nmax = 500;
    nconv = 200; (* The number of convergents 'nconv' should be increased if the linear recurrence is not found for some terms. *)
    a[n_] := a[n] = Module[{lr}, If[IntegerQ[Sqrt[n]], 1, lr = FindLinearRecurrence[Numerator[Convergents[Sqrt[n], nconv]]]; SelectFirst[lr, #>1&]/2]];
    Table[Print[n, " ", a[n] ]; a[n], {n, 1, nmax}] (* Jean-François Alcover, Feb 22 2021 *)

Extensions

Corrected and extended by T. D. Noe, May 19 2007

A013943 Period of continued fraction for sqrt(m), m = n-th nonsquare.

Original entry on oeis.org

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

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    nonSquares = Select[Range[120], !IntegerQ[Sqrt[#]]&]; a[n_] := Length[ Last[ ContinuedFraction[ Sqrt[ nonSquares[[n]] ]]]]; Table[a[n], {n, 1, Length[nonSquares]}] (* Jean-François Alcover, May 27 2013 *)
  • Python
    from math import isqrt
    from sympy.ntheory.continued_fraction import continued_fraction_periodic
    def A013943(n): return len(continued_fraction_periodic(0,1,n+(k:=isqrt(n))+int(n>=k*(k+1)+1))[-1]) # Chai Wah Wu, Jul 20 2024
Showing 1-10 of 135 results. Next