%I #43 Dec 14 2023 06:12:23
%S 11,5,1,1,5,22,5,1,1,5,22,5,1,1,5,22,5,1,1,5,22,5,1,1,5,22,5,1,1,5,22,
%T 5,1,1,5,22,5,1,1,5,22,5,1,1,5,22,5,1,1,5,22,5,1,1,5,22,5,1,1,5,22,5,
%U 1,1,5,22,5,1,1,5,22,5,1,1,5
%N Continued fraction for sqrt(125).
%C Periodic with period [5,1,1,5,22] of length 5 (after the initial term). - _M. F. Hasler_, Sep 09 2011
%H Vincenzo Librandi, <a href="/A010186/b010186.txt">Table of n, a(n) for n = 0..300</a>
%H G. Xiao, <a href="http://wims.unice.fr/~wims/en_tool~number~contfrac.en.html">'Contfrac' tool on WIMS</a>.
%H <a href="/index/Con#confC">Index entries for continued fractions for constants</a>
%H <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,0,0,1).
%F G.f.: (11+5*x+x^2+x^3+5*x^4+11*x^5)/((1-x)*(1+x+x^2+x^3+x^4)). - _Bruno Berselli_, Sep 10 2011
%F a(n) = a(n-5) for n >= 6. - _Wesley Ivan Hurt_, Mar 01 2023
%t ContinuedFraction[Sqrt[125], 300] (* _Vladimir Joseph Stephan Orlovsky_, Mar 12 2011 *)
%t LinearRecurrence[{0,0,0,0,1},{11,5,1,1,5,22},80] (* or *) PadRight[ {11},80,{22,5,1,1,5}] (* _Harvey P. Dale_, Oct 05 2016 *)
%o (PARI) default(realprecision,199); contfrac(sqrt(125)) \\ __M. F. Hasler_, Sep 09 2011
%o (PARI) a(n)=[22, 5, 1, 1, 5][n%5+1]-11*!n \\ _M. F. Hasler_, Sep 09 2011
%o (Python)
%o from sympy import sqrt
%o from sympy.ntheory.continued_fraction import continued_fraction_iterator
%o def aupton(nn):
%o gen = continued_fraction_iterator(sqrt(125))
%o return [next(gen) for i in range(nn+1)]
%o print(aupton(74)) # _Michael S. Branicky_, Nov 05 2021
%o (Python) # second version based on linear recurrence
%o def a(n): return 11 if n == 0 else [5, 1, 1, 5, 22][(n-1)%5]
%o print([a(n) for n in range(75)]) # _Michael S. Branicky_, Nov 05 2021
%Y Cf. A172074.
%K nonn,cofr,easy,nice
%O 0,1
%A _N. J. A. Sloane_
|