%I #96 Dec 27 2023 11:53:58
%S 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,
%T 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,
%U 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
%N 1 followed by {1, 2} repeated.
%C Continued fraction for sqrt(3).
%C Also coefficient of the highest power of q in the expansion of the polynomial nu(n) defined by: nu(0)=1, nu(1)=b and for n>=2, nu(n)=b*nu(n-1)+lambda*(n-1)_q*nu(n-2) with (b,lambda)=(1,1), where (n)_q=(1+q+...+q^(n-1)) and q is a root of unity. - Y. Kelly Itakura (yitkr(AT)mta.ca), Aug 21 2002
%C nu(0)=1 nu(1)=1; nu(2)=2; nu(3)=3+q; nu(4)=5+3q+2q^2; nu(5)=8+7q+6q^2+4q^3+q^4; nu(6)=13+15q+16q^2+14q^3+11q^4+5q^5+2q^6.
%C From _Jaroslav Krizek_, May 28 2010: (Start)
%C a(n) = denominators of arithmetic means of the first n positive integers for n >= 1.
%C See A026741(n+1) or A145051(n) - denominators of arithmetic means of the first n positive integers. (End)
%C From _R. J. Mathar_, Feb 16 2011: (Start)
%C This is a prototype of multiplicative sequences defined by a(p^e)=1 for odd primes p, and a(2^e)=c with some constant c, here c=2. They have Dirichlet generating functions (1+(c-1)/2^s)*zeta(s).
%C Examples are A153284, A176040 (c=3), A040005 (c=4), A021070, A176260 (c=5), A040011, A176355 (c=6), A176415 (c=7), A040019, A021059 (c=8), A040029 (c=10), A040041 (c=12). (End)
%C a(n) = p(-1) where p(x) is the unique degree-n polynomial such that p(k) = A000325(k) for k = 0, 1, ..., n. - _Michael Somos_, May 12 2012
%C For n > 0: denominators of row sums of the triangular enumeration of rational numbers A226314(n,k) / A054531(n,k), 1 <= k <= n; see A226555 for numerators. - _Reinhard Zumkeller_, Jun 10 2013
%C From _Jianing Song_, Nov 01 2022: (Start)
%C For n > 0, a(n) is the minimal gap of distinct numbers coprime to n. Proof: denote the minimal gap by b(n). For odd n we have A058026(n) > 0, hence b(n) = 1. For even n, since 1 and -1 are both coprime to n we have b(n) <= 2, and that b(n) >= 2 is obvious.
%C The maximal gap is given by A048669. (End)
%H Harry J. Smith, <a href="/A040001/b040001.txt">Table of n, a(n) for n = 0..20000</a>
%H Andrei Asinowski, Cyril Banderier, and Valerie Roitner, <a href="https://lipn.univ-paris13.fr/~banderier/Papers/several_patterns.pdf">Generating functions for lattice paths with several forbidden patterns</a>, (2019).
%H M. Beattie, S. Dăscălescu and S. Raianu, <a href="https://arxiv.org/abs/math/0204075">Lifting of Nichols Algebras of Type B_2</a>, arXiv:math/0204075 [math.QA], 2002.
%H Ashok Kumar Gupta and Ashok Kumar Mittal, <a href="http://arxiv.org/abs/math/0002227">Bifurcating continued fractions</a>, arXiv:math/0002227 [math.GM] (2000).
%H Michael Somos, <a href="http://grail.eecs.csuohio.edu/~somos/rfmc.txt">Rational Function Multiplicative Coefficients</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/SquareRoot.html">Square Root</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/TheodorussConstant.html">Theodorus's Constant</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_02">Index entries for linear recurrences with constant coefficients</a>, signature (0,1).
%F Multiplicative with a(p^e) = 2 if p even; 1 if p odd. - _David W. Wilson_, Aug 01 2001
%F 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
%F a(n) = (3-2*0^n +(-1)^n)/2. a(-n)=a(n). a(2n+1)=1, a(2n)=2, n nonzero.
%F 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
%F Row sums of triangle A133566. - _Gary W. Adamson_, Sep 16 2007
%F Euler transform of length 3 sequence [ 1, 1, -1]. - _Michael Somos_, Aug 04 2009
%F Moebius transform is length 2 sequence [ 1, 1]. - _Michael Somos_, Aug 04 2009
%F a(n) = sign(n) + ((n+1) mod 2) = 1 + sign(n) - (n mod 2). - _Wesley Ivan Hurt_, Dec 13 2013
%e 1.732050807568877293527446341... = 1 + 1/(1 + 1/(2 + 1/(1 + 1/(2 + ...))))
%e G.f. = 1 + x + 2*x^2 + x^3 + 2*x^4 + x^5 + 2*x^6 + x^7 + 2*x^8 + x^9 + ...
%p Digits := 100: convert(evalf(sqrt(N)),confrac,90,'cvgts'):
%t ContinuedFraction[Sqrt[3],300] (* _Vladimir Joseph Stephan Orlovsky_, Mar 04 2011 *)
%t PadRight[{1},120,{2,1}] (* _Harvey P. Dale_, Nov 26 2015 *)
%o (PARI) {a(n) = 2 - (n==0) - (n%2)} /* _Michael Somos_, Jun 11 2003 */
%o (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
%o (Haskell)
%o a040001 0 = 1; a040001 n = 2 - mod n 2
%o a040001_list = 1 : cycle [1, 2] -- _Reinhard Zumkeller_, Apr 16 2015
%Y Cf. A000034, A002194, A133566, A083329 (binomial Transf).
%Y Apart from a(0) the same as A134451.
%K nonn,cofr,easy,mult,frac
%O 0,3
%A _N. J. A. Sloane_