This site is supported by donations to The OEIS Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A000034 Period 2: repeat [1, 2]; a(n) = 1 + (n mod 2). (Formerly M0089) 111

%I M0089

%S 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,

%T 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,

%U 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 Period 2: repeat [1, 2]; a(n) = 1 + (n mod 2).

%C Also continued fraction for (sqrt(3)+1)/2 (cf. A040001) and base 3 digital root of n+1 (cf. A007089, A010888). - _Henry Bottomley_, Jul 05 2001

%C The sequence 1,-2,-1,2,1,-2,-1,2,... with g.f. (1-2x)/(1+x^2) has a(n) = cos(Pi*n/2)-2*sin(Pi*n/2). - _Paul Barry_, Oct 18 2004

%C Hankel transform is [1,-3,0,0,0,0,0,0,0,...]. - _Philippe Deléham_, Mar 29 2007

%C 4/33 = 0,121212... - _Eric Desbiaux_, Nov 03 2008

%C Let A be the Hessenberg matrix of order n, defined by: A[1,j]=A[i,i]:=1, A[i,i-1]=-1, and A[i,j]=0 otherwise. Then, for n>=1, a(n-1) = charpoly(A,2). - _Milan Janjic_, Jan 24 2010

%C First differences of A032766. - _Tom Edgar_, Jul 17 2014

%C Denominator of the harmonic mean of the first n triangular numbers. - _Colin Barker_, Nov 13 2014

%D Jozsef Beck, Combinatorial Games, Cambridge University Press, 2008

%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

%H Sean A. Irvine, <a href="/A000034/b000034.txt">Table of n, a(n) for n = 0..9999</a>

%H Glen Joyce C. Dulatre, Jamilah V. Alarcon, Vhenedict M. Florida, Daisy Ann A. Disu, <a href="http://www.dmmmsu-sluc.com/wp-content/uploads/2018/03/CAS-Monitor-2016-2017-1.pdf">On Fractal Sequences</a>, DMMMSU-CAS Science Monitor (2016-2017) Vol. 15 No. 2, 109-113.

%H Daniele A. Gewurz and Francesca Merola, <a href="http://www.cs.uwaterloo.ca/journals/JIS/VOL6/Gewurz/gewurz5.html">Sequences realized as Parker vectors of oligomorphic permutation groups</a>, J. Integer Seqs., Vol. 6, 2003.

%H INRIA Algorithms Project, <a href="http://ecs.inria.fr/services/structure?nbr=383">Encyclopedia of Combinatorial Structures 383</a>

%H Agustín Moreno Cañadas, Hernán Giraldo, Robinson Julian Serna Vanegas, <a href="http://dx.doi.org/10.17654/MS101122745">Some integer partitions induced by orbits of Dynkin type</a>, Far East Journal of Mathematical Sciences (FJMS), Vol. 101, No. 12 (2017), pp. 2745-2766.

%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Collatz_conjecture">Collatz conjecture</a>

%H <a href="/index/Rec#order_02">Index entries for linear recurrences with constant coefficients</a>, signature (0,1).

%F G.f.: (1+2*x)/(1-x^2).

%F a(n) = 2^((1-(-1)^n)/2) = 2^(ceiling(n/2)-floor(n/2)). - _Paul Barry_, Jun 03 2003

%F a(n) = (3-(-1)^n)/2; a(n) = 1 + (n mod 2) = 3-a(n-1) = a(n-2) = a(-n).

%F a(n) = gcd(n-1, n+1). - _Paul Barry_, Sep 16 2004

%F a(n) = 2*(n mod 2) + [(n+1) mod 2]. - _Paolo P. Lava_, Sep 20 2006

%F Binomial transform of A123344, inverse binomial transform of A003945. - _Philippe Deléham_, Jun 04 2007

%F a(n) = A134451(n+1). - _Reinhard Zumkeller_, Oct 27 2007

%F a(n) = if(n=0,1,if(mod(a(n-1),2)=0,a(n-1)/2,(3*a(n-1)+1)/2)). See Collatz conjecture. - _Paul Barry_, Mar 31 2008

%F a(n) = 2^n (mod 3). - _Vincenzo Librandi_, Feb 05 2011

%F a(n) = A000035(n) + 1. - _M. F. Hasler_, Jan 13 2012

%F a(n) = abs(sin(n*Pi/2)-2*cos(n*Pi/2)). - _Mohammad K. Azarian_, Mar 12 2012

%F a(n) = A010704(n) / 3. - _Reinhard Zumkeller_, Jul 03 2012

%F a(n) = floor(4/33*10^(n+1)) mod 10. - _Hieronymus Fischer_, Jan 03 2013

%F a(n) = floor(5/8*3^(n+1)) mod 3. - _Hieronymus Fischer_, Jan 03 2013

%F a(n) = floor((n+1)*3/2) - floor((n)*3/2). - _Hailey R. Olafson_, Jul 23 2014

%F a(n) = denominator(n/2). - _Wesley Ivan Hurt_, Sep 11 2014

%F Dirichlet g.f.: zeta(s)*(1 + 1/2^s). - _Mats Granvik_, Jul 18 2016

%F E.g.f.: 2*sinh(x) + cosh(x). - _Ilya Gutkovskiy_, Jul 18 2016

%F a(n) = A010693(n) - 1. - _Filip Zaludek_, Oct 29 2016

%p (1+2*x)/(1-x^2);

%p A000034 := proc(n) op((n mod 2)+1,[1,2]) ; end proc: # _R. J. Mathar_, Feb 05 2011

%t a[n_] := If[OddQ[n], 2, 1]; Table[a[n], {n, 0, 90}] (* _Stefan Steinerberger_, Apr 17 2006 *)

%t Nest[ Flatten[# /. { 0 -> {1}, 1 -> {2}, 2 -> {1, 2, 1} }] &, {1}, 8] (* _Robert G. Wilson v_, May 20 2014 *)

%o (PARI) a(n)=1+n%2

%o (PARI) a(n)=1+bittest(n,0) \\ _M. F. Hasler_, Jan 13 2012

%o a000034 = (+ 1) . (`mod` 2)

%o a000034_list = cycle [1,2]

%o -- _Reinhard Zumkeller_, Jul 03 2012, Dec 02 2011 and corrected by _James Spahlinger_, Oct 08 2012

%o (MAGMA) [1+(n mod 2) : n in [0..100]]; // _Wesley Ivan Hurt_, Sep 11 2014

%Y Cf. A000035, A003945, A007089, A010704, A010888, A032766, A123344, A134451.

%Y Cf. sequences listed in Comments section of A283393.

%K nonn,easy

%O 0,2

%A _N. J. A. Sloane_

%E Better definition from _M. F. Hasler_, Jan 13 2012

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

Last modified August 21 02:08 EDT 2018. Contains 313930 sequences. (Running on oeis4.)