|
| |
|
|
A000034
|
|
Period 2: repeat (1,2); a(n) = 1+n mod 2.
(Formerly M0089)
|
|
66
| |
|
|
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
(list; graph; refs; listen; history; internal format)
|
|
|
|
OFFSET
| 0,2
|
|
|
COMMENTS
| Also continued fraction for (sqrt(3)+1)/2 (cf. A040001) and base 3 digital root of n+1 (cf. A007089, A010888) - Henry Bottomley (se16(AT)btinternet.com), Jul 05 2001
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)-2sin(pi*n/2) - Paul Barry (pbarry(AT)wit.ie), Oct 18 2004
Hankel transform is [1,-3,0,0,0,0,0,0,0,...]. - Philippe DELEHAM (kolotoko(AT)wanadoo.fr), Mar 29 2007
a(n) = A134451(n+1). - Reinhard Zumkeller (reinhard.zumkeller(AT)gmail.com), Oct 27 2007
4/33=0,121212... [From Eric Desbiaux (moongerms(AT)wanadoo.fr), Nov 03 2008]
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). [From Milan R. Janjic (agnus(AT)blic.net), Jan 24 2010]
|
|
|
REFERENCES
| Jozsef Beck, Combinatorial Games, Cambridge University Press, 2008
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
|
|
|
LINKS
| Daniele A. Gewurz and Francesca Merola, Sequences realized as Parker vectors ..., J. Integer Seqs., Vol. 6, 2003.
INRIA Algorithms Project, Encyclopedia of Combinatorial Structures 383
Wikipedia, Collatz conjecture
Index entries for sequences related to linear recurrences with constant coefficients, signature (0,1).
|
|
|
FORMULA
| G.f.: (1+2*x)/(1-x^2).
a(n)=2^((1-(-1)^n)/2)=2^(ceiling(n/2)-floor(n/2)). - Paul Barry (pbarry(AT)wit.ie), Jun 03 2003
a(n) = {3 - (-1)^n}/2, or a(n)=1+(n mod 2)=3-a(n-1)=a(n-2)=a(-n).
a(n)=gcd(n-1, n+1) - Paul Barry (pbarry(AT)wit.ie), Sep 16 2004
a(n)= 2*(n mod 2) + [(n+1) mod 2] with n>=0 - Paolo P. Lava (paoloplava(AT)gmail.com), Sep 20 2006
Binomial transform of A123344, inverse binomial transform of A003945 . - Philippe DELEHAM (kolotoko(AT)wanadoo.fr), Jun 04 2007
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 (pbarry(AT)wit.ie), Mar 31 2008
a(n)=2^n (mod 3). - From Vincenzo Librandi, Feb 05 2011
A000034 = 1 + A000035. - M. F. Hasler, Jan 13 2012
|
|
|
MAPLE
| (1+2*x)/(1-x^2);
A000034 := proc(n) op((n mod 2)+1, [1, 2]) ; end proc: # R. J. Mathar, Feb 05 2011
|
|
|
MATHEMATICA
| a[n_] := If[OddQ[n], 2, 1]; Table[a[n], {n, 0, 90}] - Stefan Steinerberger (stefan.steinerberger(AT)gmail.com), Apr 17 2006
|
|
|
PROG
| (PARI) a(n)=1+n%2
(PARI) a(n)=1+bittest(n, 0). - M. F. Hasler, Jan 13 2012
(Haskell)
a000034 n = a000034_list !! n
a000034_list = cycle [1, 2]
-- Reinhard Zumkeller, Dec 02 2011
|
|
|
CROSSREFS
| Sequence in context: A167964 A168361 * A040001 A134451 A167965 A167966
Adjacent sequences: A000031 A000032 A000033 * A000035 A000036 A000037
|
|
|
KEYWORD
| nonn,easy
|
|
|
AUTHOR
| N. J. A. Sloane (njas(AT)research.att.com).
|
|
|
EXTENSIONS
| Better definition from M. F. Hasler, Jan 13 2012.
|
| |
|
|