%I #30 Dec 23 2023 14:24:14
%S 11,4,2,4,22,4,2,4,22,4,2,4,22,4,2,4,22,4,2,4,22,4,2,4,22,4,2,4,22,4,
%T 2,4,22,4,2,4,22,4,2,4,22,4,2,4,22,4,2,4,22,4,2,4,22,4,2,4,22,4,2,4,
%U 22,4,2,4,22,4,2,4,22,4,2,4
%N Continued fraction for sqrt(126).
%H Vincenzo Librandi, <a href="/A010187/b010187.txt">Table of n, a(n) for n = 0..100</a>
%H G. Xiao, <a href="http://wims.unice.fr/~wims/en_tool~number~contfrac.en.html">Contfrac</a>
%H <a href="/index/Con#confC">Index entries for continued fractions for constants</a>
%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,0,1).
%t ContinuedFraction[Sqrt[126],300] (* _Vladimir Joseph Stephan Orlovsky_, Mar 12 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(126))
%o return [next(gen) for i in range(nn+1)]
%o print(aupton(71)) # _Michael S. Branicky_, Nov 04 2021
%o (Python) # second version based on linear recurrence
%o def a(n): return 11 if n == 0 else [4, 2, 4, 22][(n-1)%4]
%o print([a(n) for n in range(72)]) # _Michael S. Branicky_, Nov 04 2021
%K nonn,cofr
%O 0,1
%A _N. J. A. Sloane_.
|