A040001 1 followed by {1, 2} repeated.
1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2
Offset: 0
Examples
1.732050807568877293527446341... = 1 + 1/(1 + 1/(2 + 1/(1 + 1/(2 + ...)))) G.f. = 1 + x + 2*x^2 + x^3 + 2*x^4 + x^5 + 2*x^6 + x^7 + 2*x^8 + x^9 + ...
References
- John H. Conway and Richard K. Guy, The Book of Numbers, New York: Springer-Verlag, 1996. See p. 186.
- Jan Gullberg, Mathematics from the Birth of Numbers, W. W. Norton & Co., NY & London, 1997, §4.4 Powers and Roots, p. 144.
- James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, page 276.
Links
- Harry J. Smith, Table of n, a(n) for n = 0..20000
- Andrei Asinowski, Cyril Banderier, and Valerie Roitner, Generating functions for lattice paths with several forbidden patterns, (2019).
- M. Beattie, S. Dăscălescu and S. Raianu, Lifting of Nichols Algebras of Type B_2, arXiv:math/0204075 [math.QA], 2002.
- Ashok Kumar Gupta and Ashok Kumar Mittal, Bifurcating continued fractions, arXiv:math/0002227 [math.GM] (2000).
- Michael Somos, Rational Function Multiplicative Coefficients.
- Eric Weisstein's World of Mathematics, Square Root.
- Eric Weisstein's World of Mathematics, Theodorus's Constant.
- G. Xiao, Contfrac.
- Index entries for continued fractions for constants.
- Index entries for linear recurrences with constant coefficients, signature (0,1).
Crossrefs
Programs
-
Haskell
a040001 0 = 1; a040001 n = 2 - mod n 2 a040001_list = 1 : cycle [1, 2] -- Reinhard Zumkeller, Apr 16 2015
-
Maple
Digits := 100: convert(evalf(sqrt(N)),confrac,90,'cvgts'):
-
Mathematica
ContinuedFraction[Sqrt[3],300] (* Vladimir Joseph Stephan Orlovsky, Mar 04 2011 *) PadRight[{1},120,{2,1}] (* Harvey P. Dale, Nov 26 2015 *)
-
PARI
{a(n) = 2 - (n==0) - (n%2)} /* Michael Somos, Jun 11 2003 */
-
PARI
{ allocatemem(932245000); default(realprecision, 12000); x=contfrac(sqrt(3)); for (n=0, 20000, write("b040001.txt", n, " ", x[n+1])); } \\ Harry J. Smith, Jun 01 2009
Formula
Multiplicative with a(p^e) = 2 if p even; 1 if p odd. - David W. Wilson, Aug 01 2001
G.f.: (1 + x + x^2) / (1 - x^2). E.g.f.: (3*exp(x)-2*exp(0)+exp(-x))/2. - Paul Barry, Apr 27 2003
a(n) = (3-2*0^n +(-1)^n)/2. a(-n)=a(n). a(2n+1)=1, a(2n)=2, n nonzero.
a(n) = sum{k=0..n, F(n-k+1)*(-2+(1+(-1)^k)/2+C(2, k)+0^k)}. - Paul Barry, Jun 22 2007
Row sums of triangle A133566. - Gary W. Adamson, Sep 16 2007
Euler transform of length 3 sequence [ 1, 1, -1]. - Michael Somos, Aug 04 2009
Moebius transform is length 2 sequence [ 1, 1]. - Michael Somos, Aug 04 2009
a(n) = sign(n) + ((n+1) mod 2) = 1 + sign(n) - (n mod 2). - Wesley Ivan Hurt, Dec 13 2013
Comments