login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

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

%I M0089 #203 Dec 16 2023 17:06:28

%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

%C This is the lexicographically earliest sequence of positive integers such that no polynomial of degree d can be fitted to d+2 consecutive terms (equivalently, such that no iterated difference is zero). - _Pontus von Brömssen_, Dec 26 2021 [See A300002 for the case where not only consecutive terms are considered. - _Pontus von Brömssen_, Jan 03 2023]

%C Number of maximum antichains in the power set of {1,2,...,n} partially ordered by set inclusion. For even n, there is a unique maximum antichain formed by all subsets of size n/2; for odd n, there are two maximum antichains, one formed by all subsets of size (n-1)/2 and the other formed by all subsets of size (n+1)/2. See the David Guichard link below for a proof. - _Jianing Song_, Jun 19 2022

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

%D J.-M. De Koninck and A. Mercier, 1001 Problèmes en Théorie Classique des Nombres, Problème 545 pages 73 and 260, Ellipses, Paris 2004.

%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 Paul Barry, <a href="https://arxiv.org/abs/2004.04577">On a Central Transform of Integer Sequences</a>, arXiv:2004.04577 [math.CO], 2020.

%H Glen Joyce C. Dulatre, Jamilah V. Alarcon, Vhenedict M. Florida and Daisy Ann A. Disu, <a href="https://web.archive.org/web/20190407151217/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 David Guichard, <a href="https://www.whitman.edu/mathematics/cgt_online/book/section01.07.html">Sperner's Theorem</a>

%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 and 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 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

%F a(n) = n + 1 - 2*floor(n/2). - _Lorenzo Sauras Altuzarra_, Jun 28 2019

%F Limit_{n->oo} (1/n)*Sum_{k=1..n} a(k) = 3/2 (De Koninck reference). - _Bernard Schott_, Nov 09 2021

%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 (Haskell)

%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

%o (GAP) List([0..120],n->1+(n mod 2)); # _Muniru A Asiru_, Feb 01 2019

%o (Python)

%o def A000034(n): return 1 + (n & 1) # _Chai Wah Wu_, May 25 2022

%Y Cf. A000035, A003945 (binomial transf), A007089, A010693, A010704, A010888, A032766, A040001, A123344, A134451, A300002.

%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 | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 12:14 EDT 2024. Contains 371792 sequences. (Running on oeis4.)