cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-6 of 6 results.

A061347 Period 3: repeat [1, 1, -2].

Original entry on oeis.org

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

Views

Author

Jason Earls, Jun 07 2001

Keywords

Comments

WARNING: It is unclear whether this sequence should start at offset 1 (as written) or offset 0 (in analogy to many similar sequences, which seems to be assumed in many of the given formulas).
Inverse binomial transform of A057079. - Paul Barry, May 15 2003
The unsigned version, with g.f. (1 + x + 2*x^2)/(1 - x^3), has a(n) = 4/3 -cos(2*Pi*n/3)/3 - sqrt(3)*sin(2*Pi*n/3)/3 = gcd(Fib(n+4), Fib(n+1)). - Paul Barry, Apr 02 2004
a(n) = L(n-2,-1), where L is defined as in A108299; see also A010892 for L(n,+1). - Reinhard Zumkeller, Jun 01 2005
From the Taylor expansion of log(1 + x + x^2) at x = 1, Sum_{k > 0} a(k)/k = log(3) = A002391. This is case n = 3 of the general expression Sum_{k > 0} (1-n*!(k mod n))/k = log(n). - Jaume Oliver Lafont, Oct 16 2009
If used with offset zero, a non-simple continued fraction representation of 2+sqrt(2). - R. J. Mathar, Mar 08 2012
Periodic sequences of this type can be also calculated by a(n) = c + floor(q/(p^m-1)*p^n) mod p, where c is a constant, q is the number representing the periodic digit pattern and m is the period length. c, p and q can be calculated as follows: Let D be the array representing the number pattern to be repeated, m = size of D, max = maximum value of elements in D, min = minimum value of elements in D. Than c := min, p := max - min + 1 and q := p^m*Sum_{i=1..m} (D(i)-min)/p^i. Example: D = (1, 1, -2), c = -2, p = 4 and q = 60 for this sequence. - Hieronymus Fischer, Jan 04 2013
This is the Dirichlet inverse of A117997. - Petros Hadjicostas, Jul 25 2020

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
		

Crossrefs

Apart from signs, same as A057079 (also bin. Transf), A100063. Cf. A000045, A010892 for the rules a(n) = a(n - 1) + a(n - 2), a(n) = a(n - 1) - a(n - 2). a(n) = - a(n - 1) + a(n - 2) gives a signed version of Fibonacci numbers.
Alternating row sums of A130777: repeat(1,-2,1).

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
a(n) = A000032(n) - A007040(n), for n > 1. - Wojciech Florek, Feb 20 2018

Extensions

Better definition from M. F. Hasler, Jan 13 2013

A007040 Number of (marked) cyclic n-bit binary strings containing no runs of length > 2.

Original entry on oeis.org

2, 2, 6, 6, 10, 20, 28, 46, 78, 122, 198, 324, 520, 842, 1366, 2206, 3570, 5780, 9348, 15126, 24478, 39602, 64078, 103684, 167760, 271442, 439206, 710646, 1149850, 1860500, 3010348, 4870846, 7881198, 12752042, 20633238, 33385284, 54018520
Offset: 1

Views

Author

Keywords

Comments

For n >= 3, also the number of maximal independent vertex sets (and minimal vertex covers) in the n-prism graph. - Eric W. Weisstein, Mar 30 and Aug 07 2017
From Petros Hadjicostas, Jul 08 2018: (Start)
Let q and m be positive integers. We denote by f1(m,q,n) the number of (marked) cyclic q-ary strings of length n that contain no runs of lengths > m when no wrapping around is allowed, and by f2(m,q,n) when wrapping around is allowed.
It is clear that f1(m,q,n) = f2(m,q,n) for n > m, but f1(m,q,n) = q^n and f2(m,q,n) = q^n - q when 1 <= n <= m.
Burstein and Wilf (1997) and Edlin and Zeilberger (2000) considered f1(m,q,n) while Hadjicostas and Zhang considered f2(m,q,n).
Let g(m, q, x) = (m+1-m*q*x)/(1-q*x+(q-1)*x^(m+1)) - (m+1)/(1-x^(m+1)).
By generalizing Moser (1991, 1993), Burstein and Wilf (1997) proved that the g.f. of the numbers f1(m,q,n) is F1(m,q,x) = ((1-x^m)/(1-x))*(q*x + (q-1)*x* g(m, q, x)).
Using the above formula by Burstein and Wilf (1997), Hadjicostas and Zhang (2018) proved that the g.f. of the numbers f2(m,q,n) is F2(m,q,x) = ((q-1)*x*(1-x^m)/(1-x))*g(m, q, x).
A necklace is an unmarked cyclic string. If f3(m,q,n) is the number of q-ary necklaces of length n with no runs of length > m (and wrapping around is allowed), then f3(m,q,n) = (1/n)*Sum_{d|n} phi(n/d)*f2(m,q,d), where phi(.) is Euler's totient function. Using this formula and F2(m,q,x), Hadjicostas and Zhang (2018) proved that the g.f. of the numbers f3(m,q,n) is given by F3(m,q,x) = -(q-1)*x*(1-x^m)/((1-x)*(1-x^(m+1))) - Sum_{s>=1} (phi(s)/s)*log(1 - (q-1)*(x^s - x^(s*(m+1)))/(1-x^s)).
For the current sequence, we have q = 2 and m = 2. We have a(n) = f1(m=2, q=2, n) = f2(m=2, q=2, n) for n >= 3, but for a(1) and a(2) it is unclear what approach the author of the sequence is following. He has a(1) = q^1 = 2, but a(2) = q^2 - q = 2^2 - 2 = 2. (Note that, for q = m = 2, we have f1(m=2, q=2, 1) = 2, f1(m=2, q=2, 2) = 4, f2(m=2, q=2, 1) = 0, and f2(m=2, q=2, 2) = 2.)
If A(x) is the g.f. of the current sequence, we have A(x) = F1(m=2,q=2, x) - 2*x^2 = F2(m=2, q=2, x) + 2*x.
When m = 1 and q = 3, we have f1(m=1, q=3, n) = number of marked cyclic words on three letters with no two consecutive like letters. We have f1(m=1, q=3, n) = A092297(n) for n >= 2. This was first stated in the comments of that sequence by G. Critzer.
When m = 1 and q = 4, we have f1(m=1, q=4, n) = number of marked cyclic words on four letters with no two consecutive like letters. We have f1(m=1, q=4, n) = A218034(n) for n >= 1. This was first stated in the comments of that sequence by J. Arndt.
A generalization of the above formula by Burstein and Wilf (1997) was given by Taylor (2014) in Section 5 of his paper. (End)

References

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

Crossrefs

Programs

  • Mathematica
    Join[{2}, LinearRecurrence[{0, 1, 2, 1}, {2, 6, 6, 10}, 40]] (* Harvey P. Dale, Nov 09 2011 *)
    Join[{2}, Table[n Sum[Binomial[2 k, n - 2 k]/k, {k, n}], {n, 2, 40}]] (* Harvey P. Dale, Nov 09 2011 *)
    Table[LucasL[n] + 2 Cos[2 n Pi/3], {n, 20}] (* Eric W. Weisstein, Mar 30 2017 *)
  • PARI
    a(n)=if(n<3,2,([0,1,0,0; 0,0,1,0; 0,0,0,1; 1,2,1,0]^(n-2)*[2;6;6;10])[1,1]) \\ Charles R Greathouse IV, Jun 15 2015

Formula

a(n) = a(n-2) + 2*a(n-3) + a(n-4), n >= 7. - David W. Wilson
a(n) = n*Sum_{k=1..n} binomial(2*k, n-2*k)/k for n > 1 with a(0) = 0 and a(1) = 2. - Vladimir Kruchinin, Oct 12 2011
G.f.: 2*x*(1 + x + 2*x^2 - x^4)/((1 - x - x^2)*(1 + x + x^2)). - Colin Barker, Mar 15 2012
a(n) = A000032(n) + 2*cos(2*Pi*n/3) for n > 1. - Eric W. Weisstein, Mar 30 2017
a(n) = 2*A100886(n-1), n > 1. - R. J. Mathar, Jan 20 2018
a(n) = A000032(n) - A061347(n) for n > 1. - Wojciech Florek, Feb 18 2018

Extensions

Name clarified by Petros Hadjicostas, Jul 08 2018

A185828 Half the number of n X 2 binary arrays with every element equal to exactly one or two of its horizontal and vertical neighbors.

Original entry on oeis.org

1, 3, 10, 23, 61, 162, 421, 1103, 2890, 7563, 19801, 51842, 135721, 355323, 930250, 2435423, 6376021, 16692642, 43701901, 114413063, 299537290, 784198803, 2053059121, 5374978562, 14071876561, 36840651123, 96450076810, 252509579303
Offset: 1

Views

Author

R. H. Hardin, Feb 05 2011

Keywords

Comments

Column 2 of A185835.

Examples

			Some solutions for 4 X 2 with a(1,1)=0:
  0 0   0 1   0 0   0 0   0 1   0 0   0 0   0 0   0 0   0 0
  1 1   0 1   0 1   1 1   0 1   1 0   0 1   1 1   1 0   0 1
  0 1   0 0   0 1   0 1   1 0   1 0   1 1   1 1   1 1   0 1
  0 0   1 1   0 0   0 1   1 0   0 0   0 0   0 0   0 0   0 1
The logarithmic g.f. begins:
L(x) = x + 3*x^2/2 + 10*x^3/3 + 23*x^4/4 + 61*x^5/5 + 162*x^6/6 + ..., where
exp(L(x)) = 1 + x + 2*x^2 + 5*x^3 + 11*x^4 + 26*x^5 + 63*x^6 + ... + A051286(n)*x^n/n + ... - _Paul D. Hanna_, Mar 19 2011
		

Crossrefs

Cf. A051286 (exp), A180662 (Fi1).

Programs

  • Maple
    a := proc(n): n*add(binomial(2*n-2*k, 2*k)/(n-k), k=0..n-1) end: seq(a(n), n=1..28); # Johannes W. Meijer, Jun 18 2018
  • PARI
    {a(n)=n*sum(k=0, n-1, binomial(2*n-2*k, 2*k)/(n-k))} /* Paul D. Hanna, Mar 19 2011 */
    
  • PARI
    {a(n)=n*polcoeff(-log( (1+x+x^2)*(1-3*x+x^2) +x*O(x^n))/2, n)} /* Paul D. Hanna, Mar 19 2011 */

Formula

Empirical: a(n) = 2*a(n-1) + a(n-2) + 2*a(n-3) - a(n-4).
a(n) = n*Sum_{k=0..n-1} C(2n-2k, 2k)/(n-k). - Paul D. Hanna, Mar 19 2011
L.g.f.: Sum_{n>=1} a(n)*x^n/n = -log((1+x+x^2)*(1-3*x+x^2))/2. - Paul D. Hanna, Mar 19 2011
Logarithmic derivative of A051286, which is the Whitney number of level n of the lattice of the ideals of the fence of order 2n. - Paul D. Hanna, Mar 19 2011
Empirical g.f.: x*(1+x+3*x^2-2*x^3)/(1+x+x^2)/(1-3*x+x^2). - Colin Barker, Feb 22 2012
Empirical: a(n) = Sum_{k=0..floor(n/2)} A084534(n, 2*k). - Johannes W. Meijer, Jun 17 2018
Empirical: a(n) = A100886(2n). - Wojciech Florek, Jan 26 2020

A100887 Expansion of (-1+2x+2x^2)/((1+x+x^2)(1-x-x^2)).

Original entry on oeis.org

-1, 2, 1, 0, 4, 4, 5, 12, 17, 26, 46, 72, 115, 190, 305, 492, 800, 1292, 2089, 3384, 5473, 8854, 14330, 23184, 37511, 60698, 98209, 158904, 257116, 416020, 673133, 1089156, 1762289, 2851442, 4613734, 7465176, 12078907, 19544086, 31622993, 51167076
Offset: 0

Views

Author

Creighton Dement, Nov 21 2004

Keywords

Comments

This sequence was investigated in cooperation with Paul Barry. Generating floretion: - 0.5'i - 0.5'k - 0.5j' - 0.5'ii' + 0.5'jj' - 0.5'kk' + 0.5'ik' - 0.5'ki' ("les").

Crossrefs

Programs

  • Mathematica
    a[n_] := Fibonacci[n + 1]/2 - Sqrt[3]Cos[2Pi*n/3 + Pi/6]; Table[ a[n], {n, 0, 39}]
    a[0] = -1; a[1] = 2; a[2] = 1; a[3] = 0; a[n_] := a[n] = a[n - 2] + 2a[n - 3] + a[n - 4]; Table[ a[n], {n, 0, 39}]
    CoefficientList[ Series[(-1 + 2x + 2x^2)/((1 - x - x^2)(1 + x + x^2)), {x, 0, 39}], x] (* Robert G. Wilson v, Dec 02 2004 *)
  • PARI
    Vec((-1+2*x+2*x^2)/((1+x+x^2)*(1-x-x^2))+O(x^99)) \\ Charles R Greathouse IV, Sep 26 2012

Formula

a(n) = Fib(n+1)/2 - sqrt(3)cos(2Pi*n/3 + Pi/6); a(n) = a(n-2) + 2a(n-3) + a(n-4), a(0) = -1, a(1) = 2, a(2) = 1, a(3) = 0

Extensions

Edited and extended by Robert G. Wilson v, Dec 02 2004

A100888 Expansion of (3+x-x^2)/((1+x+x^2)(1-x-x^2)).

Original entry on oeis.org

3, 1, 2, 7, 7, 12, 23, 33, 54, 91, 143, 232, 379, 609, 986, 1599, 2583, 4180, 6767, 10945, 17710, 28659, 46367, 75024, 121395, 196417, 317810, 514231, 832039, 1346268, 2178311, 3524577, 5702886, 9227467, 14930351, 24157816, 39088171, 63245985
Offset: 0

Views

Author

Creighton Dement, Nov 21 2004

Keywords

Comments

This sequence was investigated in cooperation with Paul Barry. Generating floretion: - 0.5'i - 0.5'k - 0.5j' - 0.5'ii' + 0.5'jj' - 0.5'kk' + 0.5'ik' - 0.5'ki' ("jes"). A100885(n) = (1/2)(A100886(n) + A100887(n) - a(n)).

Crossrefs

Programs

  • Mathematica
    a[0] = 3; a[1] = 1; a[2] = 2; a[3] = 7; a[n_] := a[n] = a[n - 2] + 2a[n - 3] + a[n - 4]; Table[ a[n], {n, 0, 37}] (* Robert G. Wilson v, Nov 26 2004 *)
    CoefficientList[ Series[(3 + x - x^2)/((1 + x + x^2)(1 - x - x^2)), {x, 0, 37}], x] (* Robert G. Wilson v, Nov 26 2004 *)
  • PARI
    Vec((3+x-x^2)/((1+x+x^2)*(1-x-x^2))+O(x^99)) \\ Charles R Greathouse IV, Sep 26 2012

Formula

a(n) = Fib(n+2) + sqrt(3)cos(2Pi*n/3 + Pi/6) + sin(2Pi*n/3 + Pi/6); a(n) = a(n-2) + 2a(n-3) + a(n-4), a(0) = 3, a(1) = 1, a(2) = 2, a(3) = 7.

Extensions

More terms from Robert G. Wilson v, Nov 26 2004

A366043 Number of circular binary sequences of length n with an odd number of 0's and no consecutive 1's.

Original entry on oeis.org

1, 2, 1, 4, 6, 8, 15, 24, 37, 62, 100, 160, 261, 422, 681, 1104, 1786, 2888, 4675, 7564, 12237, 19802, 32040, 51840, 83881, 135722, 219601, 355324, 574926, 930248, 1505175, 2435424, 3940597, 6376022, 10316620, 16692640, 27009261, 43701902, 70711161, 114413064, 185124226, 299537288, 484661515, 784198804, 1268860317
Offset: 1

Views

Author

Joshua P. Bowman, Sep 27 2023

Keywords

Comments

A circular binary sequence is a finite sequence of 0's and 1's for which the first and last digits are considered to be adjacent. Rotations are distinguished from each other. Also called a marked cyclic binary sequence.
a(n) is also equal to the number of matchings in the cycle graph C_n for which the number of edges plus the number of unmatched vertices is odd.
a(n) is also equal to the number of circular compositions of n into an odd number of 1's and 2's.

Examples

			For n = 5, the a(5) = 6 allowed sequences are 00000, 00101, 01001, 01010, 10010, 10100.
		

Crossrefs

Programs

  • Mathematica
    LinearRecurrence[{0, 1, 2, 1}, {0, 1, 2, 1}, 50]

Formula

G.f.: x*(1+2*x)/((1-x-x^2)*(1+x+x^2)).
a(n) = a(n-2) + 2*a(n-3) + a(n-4), a(0) = 0, a(1) = 1, a(2) = 2, a(3) = 1.
a(n) = (A000204(n) + A061347(n))/2.
a(n) = (1/2)*A000204(n) - cos(2*Pi*n/3).
a(n) = A000204(n) - A100886(n-1).
Showing 1-6 of 6 results.