A061347 Period 3: repeat [1, 1, -2].
1, 1, -2, 1, 1, -2, 1, 1, -2, 1, 1, -2, 1, 1, -2, 1, 1, -2, 1, 1, -2, 1, 1, -2, 1, 1, -2, 1, 1, -2, 1, 1, -2, 1, 1, -2, 1, 1, -2, 1, 1, -2, 1, 1, -2, 1, 1, -2, 1, 1, -2, 1, 1, -2, 1, 1, -2, 1, 1, -2, 1, 1, -2, 1, 1, -2, 1, 1, -2, 1, 1, -2, 1, 1, -2, 1, 1, -2, 1, 1, -2, 1, 1, -2, 1, 1, -2, 1, 1, -2, 1, 1, -2, 1, 1, -2, 1, 1, -2, 1, 1, -2, 1, 1, -2, 1, 1, -2
Offset: 1
Examples
G.f.: x + x^2 - 2*x^3 + x^4 + x^5 - 2*x^6 + x^7 + x^8 - 2*x^9 + ... - _Michael Somos_, Nov 27 2019
Links
- W. Florek, A class of generalized Tribonacci sequences applied to counting problems, Appl. Math. Comput., 338 (2018), 809-821.
- Ralph E. Griswold, Shaft Sequences, 2001 (see also here).
- Tanya Khovanova, Recursive Sequences.
- W. O. J. Moser, Cyclic binary strings without long runs of like (alternating) bits, Fibonacci Quart. 31(1) (1993), 2-6.
- Index entries for linear recurrences with constant coefficients, signature (-1,-1).
Crossrefs
Programs
-
GAP
Flat(List([1..50],n->[1,1,-2])); # Muniru A Asiru, Aug 02 2018
-
Magma
&cat [[1, 1, -2]^^30]; // Wesley Ivan Hurt, Jul 01 2016
-
Maple
seq(op([1, 1, -2]), n=1..50); # Wesley Ivan Hurt, Jul 01 2016
-
Mathematica
a[n_] := {1, 1, -2}[[Mod[n - 1, 3] + 1]]; Table[a[n], {n, 108}] (* Jean-François Alcover, Jul 19 2013 *) PadRight[{}, 90, {1, 1, -2}] (* After Harvey P. Dale, or *) CoefficientList[ Series[(2x + 1)/(x^2 + x + 1), {x, 0, 89}], x] (* or *) LinearRecurrence[{-1, -1}, {1, 1}, 90] (* Robert G. Wilson v, Jul 30 2018 *)
-
PARI
a(n)=1-3*!(n%3) \\ Jaume Oliver Lafont, Oct 16 2009
-
Sage
def A061347(): x, y = -1, -1 while True: yield -x x, y = y, -x -y a = A061347(); [next(a) for i in range(40)] # Peter Luschny, Jul 11 2013
Formula
With offset zero, a(n) = A057079(2n). a(n) = -a(n-1) - a(n-2) with a(0) = a(1) = 1.
From Mario Catalani (mario.catalani(AT)unito.it), Jan 07 2003: (Start)
G.f.: x*(1 + 2*x)/(1 + x + x^2).
a(n) = (-1)^floor(2n/3) + ((-1)^floor((2n-1)/3) + (-1)^floor((2n+1)/3))/2. (End)
a(n) = -2*cos(2*Pi*n/3). - Jaume Oliver Lafont, May 06 2008
Dirichlet g.f.: zeta(s)*(1-1/3^(s-1)). - R. J. Mathar, Feb 09 2011
a(n) = n * Sum_{k=1..n} binomial(k,n-k)/k*(-1)^(k+1). - Dmitry Kruchinin, Jun 03 2011
a(n) = -2 + floor(110/333*10^(n+1)) mod 10. - Hieronymus Fischer, Jan 04 2013
a(n) = -2 + floor(20/21*4^(n+1)) mod 4. - Hieronymus Fischer, Jan 04 2013
a(n) = a(n-3) for n > 3. - Wesley Ivan Hurt, Jul 01 2016
E.g.f.: 2 - 2*cos(sqrt(3)*x/2)*exp(-x/2). - Ilya Gutkovskiy, Jul 01 2016
a(n) = (-1)^n*hypergeom([-n/2-1, -n/2-3/2], [-n-2], 4). - Peter Luschny, Dec 17 2016
Extensions
Better definition from M. F. Hasler, Jan 13 2013
Comments