login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A031415 Numbers k such that the continued fraction for sqrt(k) has odd period and if the last term of the periodic part is deleted then there are a pair of central terms both equal to 2. 1

%I #44 Sep 16 2021 14:54:10

%S 41,61,113,130,181,202,265,269,313,317,394,421,458,586,613,617,685,

%T 697,761,773,853,925,929,937,986,1013,1066,1109,1117,1201,1213,1301,

%U 1325,1354,1409,1417,1429,1466,1586,1625,1637,1649,1714,1741,1745,1753,1861

%N Numbers k such that the continued fraction for sqrt(k) has odd period and if the last term of the periodic part is deleted then there are a pair of central terms both equal to 2.

%C In general, the simple continued fraction expansion of sqrt(m) is a periodic palindromic sequence. That is, contfrac( sqrt(m) ) = [c(0); c(1), c(2), ..., c(p), c(p+1), ...] where p is the period. c(p) = 2*c(0), c(k) = c(p+k) for k>0, c(k) = c(p-k) for p>k>0. If the period p is odd, then p = 2*k+1 and c(k) = c(k+1) can be considered a pair of equal central terms. If the period is even, then p = 2*k and the unique central term is c(k). - _Michael Somos_, Apr 04 2014

%H Chai Wah Wu, <a href="/A031415/b031415.txt">Table of n, a(n) for n = 1..10000</a> (terms n = 1..999 from T. D. Noe)

%e The simple continued fraction expansion of sqrt(41) = [6; 2, 2, 12, 2, 2, 12, 2, 2, 12, ...] with odd period 3 and two terms equal to 2. Another example is sqrt(202) = [14; 4, 1, 2, 2, 1, 4, 28, 4, 1, 2, 2, 1, 4, 28, 4, 1, 2, 2, 1, 4, 28, ...] with odd period 7 and two terms equal to 2. - _Michael Somos_, Apr 03 2014

%t n = 1; t = {}; While[Length[t] < 50, n++; If[! IntegerQ[Sqrt[n]], c = ContinuedFraction[Sqrt[n]]; len = Length[c[[2]]]; If[OddQ[len] && c[[2, (len + 1)/2]] == 2, AppendTo[t, n]]]]; t (* _T. D. Noe_, Apr 03 2014 *)

%o (Python)

%o from sympy.ntheory.continued_fraction import continued_fraction_periodic

%o A031415_list = []

%o for n in range(1,10**3):

%o cf = continued_fraction_periodic(0,1,n)

%o if len(cf) > 1 and len(cf[1]) > 1 and len(cf[1]) % 2 and cf[1][len(cf[1])//2] == 2:

%o A031415_list.append(n) # _Chai Wah Wu_, Sep 16 2021

%Y Cf. A031404-A031423.

%Y Subsequence of A003814.

%K nonn

%O 1,1

%A _David W. Wilson_

%E a(1) corrected by _T. D. Noe_, Apr 03 2014

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 03:15 EDT 2024. Contains 371964 sequences. (Running on oeis4.)