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-10 of 35 results. Next

A156072 T(n,k) = 1 + a(n) - a(k) - a(n - k), where a(n) = A078012(n+2), triangle read by rows (n >= 0, 0 <= k <= n).

Original entry on oeis.org

1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 2, 3, 2, 1, 1, 1, 2, 3, 4, 4, 3, 2, 1, 1, 3, 5, 6, 6, 6, 5, 3, 1, 1, 4, 7, 9, 9, 9, 9, 7, 4, 1, 1, 6, 10, 13, 14, 14, 14, 13, 10, 6, 1, 1, 9, 15, 19, 21, 22, 22, 21, 19, 15, 9, 1, 1, 13, 22, 28, 31, 33, 34, 33, 31, 28, 22, 13, 1
Offset: 0

Views

Author

Roger L. Bagula, Feb 03 2009

Keywords

Examples

			Triangle begins:
  1;
  1, 1;
  1, 0,  1;
  1, 0,  0,  1;
  1, 1,  1,  1,  1;
  1, 1,  2,  2,  1,  1;
  1, 1,  2,  3,  2,  1,  1;
  1, 2,  3,  4,  4,  3,  2,  1;
  1, 3,  5,  6,  6,  6,  5,  3,  1;
  1, 4,  7,  9,  9,  9,  9,  7,  4, 1;
  1, 6, 10, 13, 14, 14, 14, 13, 10, 6, 1;
  ...
		

Crossrefs

Programs

  • Mathematica
    Clear[a, t, n, m];
    a[0] = 0; a[1] = 1; a[2] = 1;
    a[n_] := a[n] = a[n - 1] + a[n - 3];
    t[n_, m_] := 1 + a[n] - a[m] - a[n - m];
    Table[Table[t[n, m], {m, 0, n}], {n, 0, 10}];
    Flatten[%]
  • Maxima
    (a[0] : 0, a[1] : 1, a[2] : 1, a[n] := a[n - 1] + a[n - 3], T(n,k) := 1 + a[n] - a[k] - a[n-k])$ create_list(T(n, k), n, 0, 20, k, 0, n); /* Franck Maminirina Ramaharo, Nov 25 2018 */

Extensions

Edited and name clarified by Franck Maminirina Ramaharo, Nov 25 2018

A172356 Triangle T(n, k) = round( c(n)/(c(k)*c(n-k)) ), where c(n) = Product_{j=1..n} A078012(j+3), read by rows.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 3, 6, 6, 3, 1, 1, 4, 12, 24, 12, 4, 1, 1, 6, 24, 72, 72, 24, 6, 1, 1, 9, 54, 216, 324, 216, 54, 9, 1, 1, 13, 117, 702, 1404, 1404, 702, 117, 13, 1, 1, 19, 247, 2223, 6669, 8892, 6669, 2223, 247, 19, 1
Offset: 0

Views

Author

Roger L. Bagula, Feb 01 2010

Keywords

Examples

			Triangle begins as:
  1;
  1,  1;
  1,  1,   1;
  1,  1,   1,    1;
  1,  2,   2,    2,    1;
  1,  3,   6,    6,    3,    1;
  1,  4,  12,   24,   12,    4,    1;
  1,  6,  24,   72,   72,   24,    6,    1;
  1,  9,  54,  216,  324,  216,   54,    9,   1;
  1, 13, 117,  702, 1404, 1404,  702,  117,  13,  1;
  1, 19, 247, 2223, 6669, 8892, 6669, 2223, 247, 19, 1;
		

Crossrefs

cf. A078012.

Programs

  • Mathematica
    f[n_, q_]:= f[n, q]= If[n<3, Fibonacci[n], q*f[n-1, q] + f[n-3, q]];
    c[n_, q_]:= Product[f[j, q], {j,n}];
    T[n_, k_, q_]:= Round[c[n, q]/(c[k, q]*c[n-k, q])];
    Table[T[n, k, 1], {n,0,12}, {k,0,n}]//Flatten (* modified by G. C. Greubel, May 09 2021 *)
  • Sage
    @CachedFunction
    def f(n,q): return fibonacci(n) if (n<3) else q*f(n-1, q) + f(n-3, q)
    def c(n,q): return product( f(j,q) for j in (1..n) )
    def T(n,k,q): return round(c(n, q)/(c(k, q)*c(n-k, q)))
    flatten([[T(n,k,1) for k in (0..n)] for n in (0..12)]) # G. C. Greubel, May 09 2021

Formula

T(n, k, q) = round( c(n,q)/(c(k,q)*c(n-k,q)) ), where c(n,q) = Product_{j=1..n} f(j,q), f(n,q) = q*f(n-1,q) + f(n-3,q), f(0,q) = 0, f(1,q) = f(2,q) = 1, and q = 1.
T(n, k) = round( c(n)/(c(k)*c(n-k)) ), where c(n) = Product_{j=1..n} A078012(j+3). - G. C. Greubel, May 09 2021

Extensions

Definition corrected to give integral terms by G. C. Greubel, May 09 2021

A000930 Narayana's cows sequence: a(0) = a(1) = a(2) = 1; thereafter a(n) = a(n-1) + a(n-3).

Original entry on oeis.org

1, 1, 1, 2, 3, 4, 6, 9, 13, 19, 28, 41, 60, 88, 129, 189, 277, 406, 595, 872, 1278, 1873, 2745, 4023, 5896, 8641, 12664, 18560, 27201, 39865, 58425, 85626, 125491, 183916, 269542, 395033, 578949, 848491, 1243524, 1822473, 2670964, 3914488, 5736961, 8407925
Offset: 0

Views

Author

Keywords

Comments

Named after a 14th-century Indian mathematician. [The sequence first appeared in the book "Ganita Kaumudi" (1356) by the Indian mathematician Narayana Pandita (c. 1340 - c. 1400). - Amiram Eldar, Apr 15 2021]
Number of compositions of n into parts 1 and 3. - Joerg Arndt, Jun 25 2011
A Lamé sequence of higher order.
Could have begun 1,0,0,1,1,1,2,3,4,6,9,... (A078012) but that would spoil many nice properties.
Number of tilings of a 3 X n rectangle with straight trominoes.
Number of ways to arrange n-1 tatami mats in a 2 X (n-1) room such that no 4 meet at a point. For example, there are 6 ways to cover a 2 X 5 room, described by 11111, 2111, 1211, 1121, 1112, 212.
Equivalently, number of compositions (ordered partitions) of n-1 into parts 1 and 2 with no two 2's adjacent. E.g., there are 6 such ways to partition 5, namely 11111, 2111, 1211, 1121, 1112, 212, so a(6) = 6. [Minor edit by Keyang Li, Oct 10 2020]
This comment covers a family of sequences which satisfy a recurrence of the form a(n) = a(n-1) + a(n-m), with a(n) = 1 for n = 0...m-1. The generating function is 1/(1-x-x^m). Also a(n) = Sum_{i=0..floor(n/m)} binomial(n-(m-1)*i, i). This family of binomial summations or recurrences gives the number of ways to cover (without overlapping) a linear lattice of n sites with molecules that are m sites wide. Special case: m=1: A000079; m=4: A003269; m=5: A003520; m=6: A005708; m=7: A005709; m=8: A005710.
a(n+2) is the number of n-bit 0-1 sequences that avoid both 00 and 010. - David Callan, Mar 25 2004 [This can easily be proved by the Cluster Method - see for example the Noonan-Zeilberger article. - N. J. A. Sloane, Aug 29 2013]
a(n-4) is the number of n-bit sequences that start and end with 0 but avoid both 00 and 010. For n >= 6, such a sequence necessarily starts 011 and ends 110; deleting these 6 bits is a bijection to the preceding item. - David Callan, Mar 25 2004
Also number of compositions of n+1 into parts congruent to 1 mod m. Here m=3, A003269 for m=4, etc. - Vladeta Jovovic, Feb 09 2005
Row sums of Riordan array (1/(1-x^3), x/(1-x^3)). - Paul Barry, Feb 25 2005
Row sums of Riordan array (1,x(1+x^2)). - Paul Barry, Jan 12 2006
Starting with offset 1 = row sums of triangle A145580. - Gary W. Adamson, Oct 13 2008
Number of digits in A061582. - Dmitry Kamenetsky, Jan 17 2009
From Jon Perry, Nov 15 2010: (Start)
The family a(n) = a(n-1) + a(n-m) with a(n)=1 for n=0..m-1 can be generated by considering the sums (A102547):
1 1 1 1 1 1 1 1 1 1 1 1 1
1 2 3 4 5 6 7 8 9 10
1 3 6 10 15 21 28
1 4 10 20
1
------------------------------
1 1 1 2 3 4 6 9 13 19 28 41 60
with (in this case 3) leading zeros added to each row.
(End)
Number of pairs of rabbits existing at period n generated by 1 pair. All pairs become fertile after 3 periods and generate thereafter a new pair at all following periods. - Carmine Suriano, Mar 20 2011
The compositions of n in which each natural number is colored by one of p different colors are called p-colored compositions of n. For n>=3, 2*a(n-3) equals the number of 2-colored compositions of n with all parts >= 3, such that no adjacent parts have the same color. - Milan Janjic, Nov 27 2011
For n>=2, row sums of Pascal's triangle (A007318) with triplicated diagonals. - Vladimir Shevelev, Apr 12 2012
Pisano period lengths of the sequence read mod m, m >= 1: 1, 7, 8, 14, 31, 56, 57, 28, 24, 217, 60, 56, 168, ... (A271953) If m=3, for example, the remainder sequence becomes 1, 1, 1, 2, 0, 1, 0, 0, 1, 1, 1, 2, 0, 1, 0, 0, 1, 1, 1, 2, 0, 1, 0, 0, 1, 1, 1, 2, 0, 1, 0, 0, 1, 1, ... with a period of length 8. - R. J. Mathar, Oct 18 2012
Diagonal sums of triangle A011973. - John Molokach, Jul 06 2013
"In how many ways can a kangaroo jump through all points of the integer interval [1,n+1] starting at 1 and ending at n+1, while making hops that are restricted to {-1,1,2}? (The OGF is the rational function 1/(1 - z - z^3) corresponding to A000930.)" [Flajolet and Sedgewick, p. 373] - N. J. A. Sloane, Aug 29 2013
a(n) is the number of length n binary words in which the length of every maximal run of consecutive 0's is a multiple of 3. a(5) = 4 because we have: 00011, 10001, 11000, 11111. - Geoffrey Critzer, Jan 07 2014
a(n) is the top left entry of the n-th power of the 3X3 matrix [1, 0, 1; 1, 0, 0; 0, 1, 0] or of the 3 X 3 matrix [1, 1, 0; 0, 0, 1; 1, 0, 0]. - R. J. Mathar, Feb 03 2014
a(n-3) is the top left entry of the n-th power of any of the 3 X 3 matrices [0, 1, 0; 0, 1, 1; 1, 0, 0], [0, 0, 1; 1, 1, 0; 0, 1, 0], [0, 1, 0; 0, 0, 1; 1, 0, 1] or [0, 0, 1; 1, 0, 0; 0, 1, 1]. - R. J. Mathar, Feb 03 2014
Counts closed walks of length (n+3) on a unidirectional triangle, containing a loop at one of remaining vertices. - David Neil McGrath, Sep 15 2014
a(n+2) equals the number of binary words of length n, having at least two zeros between every two successive ones. - Milan Janjic, Feb 07 2015
a(n+1)/a(n) tends to x = 1.465571... (decimal expansion given in A092526) in the limit n -> infinity. This is the real solution of x^3 - x^2 -1 = 0. See also the formula by Benoit Cloitre, Nov 30 2002. - Wolfdieter Lang, Apr 24 2015
a(n+2) equals the number of subsets of {1,2,..,n} in which any two elements differ by at least 3. - Robert FERREOL, Feb 17 2016
Let T* be the infinite tree with root 0 generated by these rules: if p is in T*, then p+1 is in T* and x*p is in T*. Let g(n) be the set of nodes in the n-th generation, so that g(0) = {0}, g(1) = {1}, g(2) = {2,x}, g(3) = {3,2x,x+1,x^2}, etc. Let T(r) be the tree obtained by substituting r for x. If a positive integer N such that r = N^(1/3) is not an integer, then the number of (not necessarily distinct) integers in g(n) is A000930(n), for n >= 1. (See A274142.) - Clark Kimberling, Jun 13 2016
a(n-3) is the number of compositions of n excluding 1 and 2, n >= 3. - Gregory L. Simay, Jul 12 2016
Antidiagonal sums of array A277627. - Paul Curtz, May 16 2019
a(n+1) is the number of multus bitstrings of length n with no runs of 3 ones. - Steven Finch, Mar 25 2020
Suppose we have a(n) samples, exactly one of which is positive. Assume the cost for testing a mix of k samples is 3 if one of the samples is positive (but you will not know which sample was positive if you test more than 1) and 1 if none of the samples is positive. Then the cheapest strategy for finding the positive sample is to have a(n-3) undergo the first test and then continue with testing either a(n-4) if none were positive or with a(n-6) otherwise. The total cost of the tests will be n. - Ruediger Jehn, Dec 24 2020

Examples

			The number of compositions of 11 without any 1's and 2's is a(11-3) = a(8) = 13. The compositions are (11), (8,3), (3,8), (7,4), (4,7), (6,5), (5,6), (5,3,3), (3,5,3), (3,3,5), (4,4,3), (4,3,4), (3,4,4). - _Gregory L. Simay_, Jul 12 2016
The compositions from the above example may be mapped to the a(8) compositions of 8 into 1's and 3's using this (more generally applicable) method: replace all numbers greater than 3 with a 3 followed by 1's to make the same total, then remove the initial 3 from the composition. Maintaining the example's order, they become (1,1,1,1,1,1,1,1), (1,1,1,1,1,3), (3,1,1,1,1,1), (1,1,1,1,3,1), (1,3,1,1,1,1), (1,1,1,3,1,1), (1,1,3,1,1,1), (1,1,3,3), (3,1,1,3), (3,3,1,1), (1,3,1,3), (1,3,3,1), (3,1,3,1). - _Peter Munn_, May 31 2017
		

References

  • A. T. Benjamin and J. J. Quinn, Proofs that really count: the art of combinatorial proof, M.A.A., 2003, id. 8,80.
  • R. K. Guy, "Anyone for Twopins?" in D. A. Klarner, editor, The Mathematical Gardner. Prindle, Weber and Schmidt, Boston, 1981, pp. 2-15. [See p. 12, line 3]
  • H. Langman, Play Mathematics. Hafner, NY, 1962, p. 13.
  • David Sankoff and Lani Haque, Power Boosts for Cluster Tests, in Comparative Genomics, Lecture Notes in Computer Science, Volume 3678/2005, Springer-Verlag. - N. J. A. Sloane, Jul 09 2009
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

For Lamé sequences of orders 1 through 9 see A000045, this sequence, and A017898 - A017904.
Essentially the same as A068921 and A078012.
See also A001609, A145580, A179070, A214551 (same rule except divide by GCD).
A271901 and A271953 give the period of this sequence mod n.
A120562 has the same recurrence for odd n.

Programs

  • GAP
    a:=[1,1,1];; for n in [4..50] do a[n]:=a[n-1]+a[n-3]; od; a; # Muniru A Asiru, Aug 13 2018
    
  • Haskell
    a000930 n = a000930_list !! n
    a000930_list = 1 : 1 : 1 : zipWith (+) a000930_list (drop 2 a000930_list)
    -- Reinhard Zumkeller, Sep 25 2011
    
  • Magma
    [1,1] cat [ n le 3 select n else Self(n-1)+Self(n-3): n in [1..50] ]; // Vincenzo Librandi, Apr 25 2015
    
  • Maple
    f := proc(r) local t1,i; t1 := []; for i from 1 to r do t1 := [op(t1),0]; od: for i from 1 to r+1 do t1 := [op(t1),1]; od: for i from 2*r+2 to 50 do t1 := [op(t1),t1[i-1]+t1[i-1-r]]; od: t1; end; # set r = order
    with(combstruct): SeqSetU := [S, {S=Sequence(U), U=Set(Z, card > 2)}, unlabeled]: seq(count(SeqSetU, size=j), j=3..40); # Zerinvary Lajos, Oct 10 2006
    A000930 := proc(n)
        add(binomial(n-2*k,k),k=0..floor(n/3)) ;
    end proc: # Zerinvary Lajos, Apr 03 2007
    a:= n-> (<<1|1|0>, <0|0|1>, <1|0|0>>^n)[1,1]:
    seq(a(n), n=0..50); # Alois P. Heinz, Jun 20 2008
  • Mathematica
    a[0] = 1; a[1] = a[2] = 1; a[n_] := a[n] = a[n - 1] + a[n - 3]; Table[ a[n], {n, 0, 40} ]
    CoefficientList[Series[1/(1 - x - x^3), {x, 0, 45}], x] (* Zerinvary Lajos, Mar 22 2007 *)
    LinearRecurrence[{1, 0, 1}, {1, 1, 1}, 80] (* Vladimir Joseph Stephan Orlovsky, Feb 11 2012 *)
    a[n_] := HypergeometricPFQ[{(1 - n)/3, (2 - n)/3, -n/3}, {(1 - n)/ 2, -n/2}, -27/4]; Table[a[n], {n, 0, 43}] (* Jean-François Alcover, Feb 26 2013 *)
    Table[-RootSum[1 + #^2 - #^3 &, 3 #^(n + 2) - 11 #^(n + 3) + 2 #^(n + 4) &]/31, {n, 20}] (* Eric W. Weisstein, Feb 14 2025 *)
  • Maxima
    makelist(sum(binomial(n-2*k,k),k,0,n/3),n,0,18); /* Emanuele Munarini, May 24 2011 */
    
  • PARI
    a(n)=polcoeff(exp(sum(m=1,n,((1+sqrt(1+4*x))^m + (1-sqrt(1+4*x))^m)*(x/2)^m/m)+x*O(x^n)),n) \\ Paul D. Hanna, Oct 08 2009
    
  • PARI
    x='x+O('x^66); Vec(1/(1-(x+x^3))) \\ Joerg Arndt, May 24 2011
    
  • PARI
    a(n)=([0,1,0;0,0,1;1,0,1]^n*[1;1;1])[1,1] \\ Charles R Greathouse IV, Feb 26 2017
    
  • Python
    from itertools import islice
    def A000930_gen(): # generator of terms
        blist = [1]*3
        while True:
            yield blist[0]
            blist = blist[1:]+[blist[0]+blist[2]]
    A000930_list = list(islice(A000930_gen(),30)) # Chai Wah Wu, Feb 04 2022
    
  • SageMath
    @CachedFunction
    def a(n): # A000930
        if (n<3): return 1
        else: return a(n-1) + a(n-3)
    [a(n) for n in (0..80)] # G. C. Greubel, Jul 29 2022

Formula

G.f.: 1/(1-x-x^3). - Simon Plouffe in his 1992 dissertation
a(n) = Sum_{i=0..floor(n/3)} binomial(n-2*i, i).
a(n) = a(n-2) + a(n-3) + a(n-4) for n>3.
a(n) = floor(d*c^n + 1/2) where c is the real root of x^3-x^2-1 and d is the real root of 31*x^3-31*x^2+9*x-1 (c = 1.465571... = A092526 and d = 0.611491991950812...). - Benoit Cloitre, Nov 30 2002
a(n) = Sum_{k=0..n} binomial(floor((n+2k-2)/3), k). - Paul Barry, Jul 06 2004
a(n) = Sum_{k=0..n} binomial(k, floor((n-k)/2))(1+(-1)^(n-k))/2. - Paul Barry, Jan 12 2006
a(n) = Sum_{k=0..n} binomial((n+2k)/3,(n-k)/3)*(2*cos(2*Pi*(n-k)/3)+1)/3. - Paul Barry, Dec 15 2006
a(n) = term (1,1) in matrix [1,1,0; 0,0,1; 1,0,0]^n. - Alois P. Heinz, Jun 20 2008
G.f.: exp( Sum_{n>=1} ((1+sqrt(1+4*x))^n + (1-sqrt(1+4*x))^n)*(x/2)^n/n ).
Logarithmic derivative equals A001609. - Paul D. Hanna, Oct 08 2009
a(n) = a(n-1) + a(n-2) - a(n-5) for n>4. - Paul Weisenhorn, Oct 28 2011
For n >= 2, a(2*n-1) = a(2*n-2)+a(2*n-4); a(2*n) = a(2*n-1)+a(2*n-3). - Vladimir Shevelev, Apr 12 2012
INVERT transform of (1,0,0,1,0,0,1,0,0,1,...) = (1, 1, 1, 2, 3, 4, 6, ...); but INVERT transform of (1,0,1,0,0,0,...) = (1, 1, 2, 3, 4, 6, ...). - Gary W. Adamson, Jul 05 2012
G.f.: 1/(G(0)-x) where G(k) = 1 - x^2/(1 - x^2/(x^2 - 1/G(k+1) )); (continued fraction). - Sergei N. Gladkovskii, Dec 16 2012
G.f.: 1 + x/(G(0)-x) where G(k) = 1 - x^2*(2*k^2 + 3*k +2) + x^2*(k+1)^2*(1 - x^2*(k^2 + 3*k +2))/G(k+1); (continued fraction). - Sergei N. Gladkovskii, Dec 27 2012
a(2*n) = A002478(n), a(2*n+1) = A141015(n+1), a(3*n) = A052544(n), a(3*n+1) = A124820(n), a(3*n+2) = A052529(n+1). - Johannes W. Meijer, Jul 21 2013, corrected by Greg Dresden, Jul 06 2020
G.f.: Q(0)/2, where Q(k) = 1 + 1/(1 - x*(4*k+1 + x^2)/( x*(4*k+3 + x^2) + 1/Q(k+1) )); (continued fraction). - Sergei N. Gladkovskii, Sep 08 2013
a(n) = v1*w1^n+v3*w2^n+v2*w3^n, where v1,2,3 are the roots of (-1+9*x-31*x^2+31*x^3): [v1=0.6114919920, v2=0.1942540040 - 0.1225496913*I, v3=conjugate(v2)] and w1,2,3 are the roots of (-1-x^2+x^3): [w1=1.4655712319, w2=-0.2327856159 - 0.7925519925*I, w3=conjugate(w2)]. - Gerry Martens, Jun 27 2015
a(n) = (6*A001609(n+3) + A001609(n-7))/31 for n>=7. - Areebah Mahdia, Jun 07 2020
a(n+6)^2 + a(n+1)^2 + a(n)^2 = a(n+5)^2 + a(n+4)^2 + 3*a(n+3)^2 + a(n+2)^2. - Greg Dresden, Jul 07 2021
a(n) = Sum_{i=(n-7)..(n-1)} a(i) / 2. - Jules Beauchamp, May 10 2025

Extensions

Name expanded by N. J. A. Sloane, Sep 07 2012

A077868 Expansion of 1/((1-x)*(1-x-x^3)).

Original entry on oeis.org

1, 2, 3, 5, 8, 12, 18, 27, 40, 59, 87, 128, 188, 276, 405, 594, 871, 1277, 1872, 2744, 4022, 5895, 8640, 12663, 18559, 27200, 39864, 58424, 85625, 125490, 183915, 269541, 395032, 578948, 848490, 1243523, 1822472, 2670963, 3914487, 5736960, 8407924, 12322412
Offset: 0

Views

Author

N. J. A. Sloane, Nov 17 2002

Keywords

Comments

Row sums of Riordan array (1/(1-x), x*(1+x^2)). - Paul Barry, Feb 16 2005
a(n) is the number of partitions of {1, ..., n+3} into two blocks in which only 1- or 3-strings of consecutive integers can appear in a block and there is at least one 3-string. E.g., a(3)=5 because the enumerated partitions of {1,2,3,4,5,6} are 1235/46, 1345/26, 15/2346, 13/2456, 123/456. - Augustine O. Munagi, Apr 11 2005

References

  • Chu, Hung Viet. "Various Sequences from Counting Subsets." Fib. Quart., 59:2 (May 2021), 150-157.

Crossrefs

Programs

  • Magma
    A077868:= func< n | n eq 0 select 0 else (&+[Binomial(n-2*j+, j+1): j in [0..Floor((n+1)/3)]]) >;
    [A077868(n): n in [0..40]]; // G. C. Greubel, Jul 27 2022
    
  • Maple
    a:= n-> (Matrix(4, (i,j)-> if i=j-1 then 1 elif j=1 then [2,-1,1,-1][i] else 0 fi)^n)[1,1]: seq(a(n), n=0..41); # Alois P. Heinz, Sep 05 2008
    g:=(1+z+z^2)/(1-z-z^3): gser:=series(g, z=0, 43): seq(coeff(gser, z, n)-1, n=1..42); # Zerinvary Lajos, Jan 09 2009
  • Mathematica
    LinearRecurrence[{1,1,0,0,-1}, {1,2,3,5,8,12}, 42] (* or *)
    CoefficientList[Series[1/((1-x)(1-x-x^3)), {x, 0, 41}], x] (* Michael De Vlieger, Jun 06 2018 *)
  • PARI
    Vec(1/(1-x)/(1-x-x^3)+O(x^99)) \\ Charles R Greathouse IV, Sep 23 2012
    
  • PARI
    {a = vector(50);
    a[1] = 1; a[2] = 2; a[3] = 3;
    for(n=4,50,
    a[n] = 1 + a[n-1] + a[n-3];
    ); a} \\ Gerry Martens, Jun 03 2018
    
  • PARI
    {a(n) = if( n<0, n=-4-n; polcoeff( -1 / (1 - x) / (1 + x^2 - x^3) + x * O(x^n), n), polcoeff( 1 / (1 - x) / (1 - x - x^3) + x * O(x^n), n))}; /* Michael Somos, Jun 17 2018 */
    
  • SageMath
    def A077868(n): return sum(binomial(n-2*j+1, j+1) for j in (0..((n+1)//3)))
    [A077868(n) for n in (0..40)] # G. C. Greubel, Jul 27 2022

Formula

Partial sums of A000930. a(n-1) = Sum_{k=0..floor(n/2)} binomial(n-2*k, k+1). - Paul Barry, Jul 07 2004
a(n-3) = Sum(binomial(n-r, r)), r=1, 2, ... which is the case t=3 and k=2 in the general case of t-strings and k blocks: a(n-3, k, t) = Sum(binomial(n-r*(t-1), r)*S2(n-r*(t-1)-1, k-1)), r=1, 2, ... - Augustine O. Munagi, Apr 11 2005
From Paul Weisenhorn, Oct 28 2011: (Start)
a(n) = a(n-1) + a(n-2) - a(n-5) for n > 4.
a(n) = a(n-2) + a(n-3) + a(n-4) + 2 for n > 3.
G.f.: 1/((1-x)*(1-x-x^3)). (End)
a(n) = 1 + a(n-1) + a(n-3), a(1)=1, a(2)=2, a(3)=3. - Gerry Martens, Jun 10 2018
a(n) = -A077888(-4-n) for all n in Z. - Michael Somos, Jun 17 2018
a(n) = A000930(n+3) - 1. - Greg Dresden, Jun 20 2021
a(n) = A099567(n+3, 4). - G. C. Greubel, Jul 27 2022

Extensions

More terms from Augustine O. Munagi, Apr 11 2005

A077961 Expansion of 1 / (1 + x^2 - x^3) in powers of x.

Original entry on oeis.org

1, 0, -1, 1, 1, -2, 0, 3, -2, -3, 5, 1, -8, 4, 9, -12, -5, 21, -7, -26, 28, 19, -54, 9, 73, -63, -64, 136, 1, -200, 135, 201, -335, -66, 536, -269, -602, 805, 333, -1407, 472, 1740, -1879, -1268, 3619, -611, -4887, 4230, 4276, -9117, -46, 13393, -9071, -13439, 22464, 4368, -35903, 18096, 40271, -53999
Offset: 0

Views

Author

N. J. A. Sloane, Nov 17 2002

Keywords

Examples

			G.f. = 1 - x^2 + x^3 + x^4 - 2*x^5 + 3*x^7 - 2*x^8 - 3*x^9 + 5*x^10 + x^11 + ...
		

Crossrefs

Programs

  • Magma
    I:=[1,0,-1]; [n le 3 select I[n] else -Self(n-2) +Self(n-3): n in [1..70]]; // G. C. Greubel, Mar 28 2024
    
  • Maple
    a:= n-> (<<0|1|0>, <-1|0|1>, <1|0|0>>^n)[1, 1]:
    seq(a(n), n=0..50);  # Alois P. Heinz, Jun 20 2008
  • Mathematica
    a[ n_] := If[ n >= 0, SeriesCoefficient[ 1 / (1 + x^2 - x^3), {x, 0, n}], SeriesCoefficient[ x^3 / (1 - x - x^3), {x, 0, -n}]] (* Michael Somos, Jan 08 2014 *)
  • PARI
    {a(n) = if( n<0, polcoeff( x^3 / (1 - x - x^3) + x * O(x^-n), -n), polcoeff( 1 / (1 + x^2 - x^3) + x * O(x^n), n))} /* Michael Somos, Jan 08 2014 */
    
  • SageMath
    [sum((-1)^(n+k)*binomial(k,n-2*k) for k in range(1+n//2)) for n in range(71)] # G. C. Greubel, Mar 28 2024

Formula

a(n) = Sum_{k=0..floor(n/2)} (-1)^(n-k)*binomial(k, n-2*k). - Paul Barry, Jun 24 2005
From Alois P. Heinz, Jun 20 2008: (Start)
a(n) = term (1,1) in matrix [0,1,0; -1,0,1; 1,0,0]^n.
a(n) = A000930 (-3-n). (End)
a(-n) = A078012(n). - Michael Somos, May 03 2011
From Michael Somos, Jan 08 2014: (Start)
a(-n) = A135851(n+2).
a(n)^2 - a(n-1)*a(n+1) = A135851(n+5). (End)
G.f.: Q(0)/2 , where Q(k) = 1 + 1/(1 - x^2*(4*k+1 - x )/( x^2*(4*k+3 - x ) - 1/Q(k+1) )); (continued fraction). - Sergei N. Gladkovskii, Sep 09 2013
a(n)^2 + a(n-1)^2 + a(n-6)^2 = a(n-2)^2 + 3*a(n-3)^2 + a(n-4)^2 + a(n-5)^2. - Greg Dresden, Apr 12 2025

A013979 Expansion of 1/(1 - x^2 - x^3 - x^4) = 1/((1 + x)*(1 - x - x^3)).

Original entry on oeis.org

1, 0, 1, 1, 2, 2, 4, 5, 8, 11, 17, 24, 36, 52, 77, 112, 165, 241, 354, 518, 760, 1113, 1632, 2391, 3505, 5136, 7528, 11032, 16169, 23696, 34729, 50897, 74594, 109322, 160220, 234813, 344136, 504355, 739169, 1083304, 1587660, 2326828, 3410133, 4997792, 7324621
Offset: 0

Views

Author

Keywords

Comments

For n>0, number of compositions (ordered partitions) of n into 2's, 3's and 4's. - Len Smiley, May 08 2001
Diagonal sums of trinomial triangle A071675 (Riordan array (1, x*(1+x+x^2))). - Paul Barry, Feb 15 2005
For n>1, a(n) is number of compositions of n-2 into parts 1 and 2 with no 3 consecutive 1's. For example: a(7) = 5 because we have: 2+2+1, 2+1+2, 1+2+2, 1+2+1+1, 1+1+2+1. - Geoffrey Critzer, Mar 15 2014
In the same way [per 2nd comment for A006498, by Sreyas Srinivasan] that the sum of any two alternating terms (terms separated by one term) of A006498 produces a term from A000045 (the Fibonacci sequence), so it could therefore be thought of as a "metaFibonacci," the sum of any two (nonalternating) terms of this sequence produces a term from A000930 (Narayana’s cows), so this sequence could analogously be called "meta-Narayana’s cows" (e.g. 4+5=9, 5+8=13, 8+11=19, 11+17=28). - Michael Cohen and Yasuyuki Kachi, Jun 13 2024

Examples

			G.f. = 1 + x^2 + x^3 + 2*x^4 + 2*x^5 + 4*x^6 + 5*x^7 + 8*x^8 + 11*x^9 + ...
		

Crossrefs

Cf. A060945 (Ordered partitions into 1's, 2's and 4's).
First differences of A023435.

Programs

  • Haskell
    a013979 n = a013979_list !! n
    a013979_list = 1 : 0 : 1 : 1 : zipWith (+) a013979_list
       (zipWith (+) (tail a013979_list) (drop 2 a013979_list))
    -- Reinhard Zumkeller, Mar 23 2012
    
  • Magma
    R:=PowerSeriesRing(Integers(), 50); Coefficients(R!( 1/((1+x)*(1-x-x^3)) )); // G. C. Greubel, Jul 17 2023
    
  • Mathematica
    a[n_]:= If[n<0, SeriesCoefficient[x^4/(1 +x +x^2 -x^4), {x, 0, -n}], SeriesCoefficient[1/(1 -x^2 -x^3 -x^4), {x,0,n}]]; (* Michael Somos, Jun 20 2015 *)
    LinearRecurrence[{0,1,1,1}, {1,0,1,1}, 50] (* G. C. Greubel, Jul 17 2023 *)
  • SageMath
    @CachedFunction
    def b(n): return 1 if (n<3) else b(n-1) + b(n-3) # b = A000930
    def A013979(n): return ((-1)^n +2*b(n) -b(n-1) +b(n-2) -int(n==1))/3
    [A013979(n) for n in (0..50)] # G. C. Greubel, Jul 17 2023

Formula

a(n) = Sum_{k=0..floor(n/2)} Sum_{i=0..floor(n/2)} C(k, 2i+3k-n)*C(2i+3k-n, i). - Paul Barry, Feb 15 2005
a(n) = a(n-4) + a(n-3) + a(n-2). - Jon E. Schoenfield, Aug 07 2006
a(n) + a(n+1) = A000930(n+1). - R. J. Mathar, Mar 14 2011
a(n) = (1/3)*(A000930(n) + A097333(n-2) + (-1)^n), n>1. - Ralf Stephan, Aug 15 2013
a(n) = (-1)^n * A077889(-4-n) = A107458(n+4) for all n in Z. - Michael Somos, Jun 20 2015
a(n) = Sum_{i=0..floor(n/2)} A078012(n-2*i). - Paul Curtz, Aug 18 2021
a(n) = (1/3)*((-1)^n + 2*b(n) - b(n-1) + b(n-2) - [n=1]), where b(n) = A000930(n). - G. C. Greubel, Jul 17 2023

A144903 Square array A(n,k), n>=0, k>=0, read by antidiagonals, where column k is the expansion of x/((1-x-x^3)*(1-x)^(k-1)).

Original entry on oeis.org

0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 2, 1, 1, 0, 1, 3, 3, 2, 1, 0, 1, 4, 6, 5, 3, 1, 0, 1, 5, 10, 11, 8, 4, 2, 0, 1, 6, 15, 21, 19, 12, 6, 3, 0, 1, 7, 21, 36, 40, 31, 18, 9, 4, 0, 1, 8, 28, 57, 76, 71, 49, 27, 13, 6, 0, 1, 9, 36, 85, 133, 147, 120, 76, 40, 19, 9, 0, 1, 10, 45, 121, 218, 280, 267, 196, 116, 59, 28, 13
Offset: 0

Views

Author

Alois P. Heinz, Sep 24 2008

Keywords

Examples

			Square array (A(n,k)) begins:
  0, 0,  0,  0,  0,   0,   0 ... A000004;
  1, 1,  1,  1,  1,   1,   1 ... A000012;
  0, 1,  2,  3,  4,   5,   6 ... A001477;
  0, 1,  3,  6, 10,  15,  21 ... A000217;
  1, 2,  5, 11, 21,  36,  57 ... A050407;
  1, 3,  8, 19, 40,  76, 133 ... ;
  1, 4, 12, 31, 71, 147, 200 ... A027658;
Antidiagonal triangle (T(n,k)) begins as:
  0;
  0,  1;
  0,  1,  0;
  0,  1,  1,  0;
  0,  1,  2,  1,  1;
  0,  1,  3,  3,  2,  1;
  0,  1,  4,  6,  5,  3,  1;
  0,  1,  5, 10, 11,  8,  4,  2;
  0,  1,  6, 15, 21, 19, 12,  6,  3;
		

Crossrefs

Rows 0-4, 6 give: A000004, A000012, A001477, A000217, A050407(n+3), A027658.
Columns 0-9 give: A078012 and A135851(n+2), A078012(n+2) and A135851(n+4), A077868(n-1) for n>0, A050228(n-1) for n>0, A226405, A144898, A144899, A144900, A144901, A144902.
Main diagonal gives: A144904.
Cf. A000930.

Programs

  • Magma
    A000930:= func< n | (&+[Binomial(n-2*j,j): j in [0..Floor(n/3)]]) >;
    A144903:= func< n,k | k eq 0 select 0 else (&+[Binomial(n-k+j-2,j)*A000930(k-j-1) : j in [0..k-1]]) >;
    [A144903(n,k): k in [0..n], n in [0..15]]; // G. C. Greubel, Aug 01 2022
    
  • Maple
    A:= proc(n,k) coeftayl (x/ (1-x-x^3)/ (1-x)^(k-1), x=0, n) end:
    seq(seq(A(n, d-n), n=0..d), d=0..13);
  • Mathematica
    (* First program *)
    a[n_, k_] := SeriesCoefficient[x/((1-x-x^3)*(1-x)^(k-1)), {x, 0, n}];
    Table[a[n-k, k], {n,0,12}, {k,n,0,-1}]//Flatten (* Jean-François Alcover, Jan 15 2014 *)
    (* Second Program *)
    A000930[n_]:= A000930[n]= Sum[Binomial[n-2*j,j], {j,0,Floor[n/3]}];
    T[n_, k_]:= T[n, k]= If[k==0, 0, Sum[Binomial[n-k+j-2,j]*A000930[k-j-1], {j,0,k- 1}]];
    Table[T[n, k], {n,0,15}, {k,0,n}]//Flatten (* G. C. Greubel, Aug 01 2022 *)
  • SageMath
    def A000930(n): return sum(binomial(n-2*j,j) for j in (0..(n//3)))
    def A144903(n,k):
        if (k==0): return 0
        else: return sum(binomial(n-k+j-2,j)*A000930(k-j-1) for j in (0..k-1))
    flatten([[A144903(n,k) for k in (0..n)] for n in (0..15)]) # G. C. Greubel, Aug 01 2022

Formula

G.f. of column k: x/((1-x-x^3)*(1-x)^(k-1)).
A(n, n) = A144904(n).
From G. C. Greubel, Aug 01 2022: (Start)
A(n, k) = Sum_{j=0..n-1} binomial(k+j-2, j)*A000930(n-j-1), with A(0, k) = 0.
T(n, k) = Sum_{j=0..k-1} binomial(n-k-j-2, j)*A000930(k-j-1), with T(n, 0) = 0.
T(2*n, n) = A144904(n). (End)

A050228 a(n) is the number of subsequences {s(k)} of {1,2,3,...n} such that s(k+1)-s(k) is 1 or 3.

Original entry on oeis.org

1, 3, 6, 11, 19, 31, 49, 76, 116, 175, 262, 390, 578, 854, 1259, 1853, 2724, 4001, 5873, 8617, 12639, 18534, 27174, 39837, 58396, 85596, 125460, 183884, 269509, 394999, 578914, 848455, 1243487, 1822435, 2670925, 3914448, 5736920, 8407883
Offset: 1

Views

Author

John W. Layman, Dec 20 1999

Keywords

Comments

The second differences c(n) of {a(n)} satisfy c(n)=c(n-1)+c(n-3) and give A000930 with the first 5 terms deleted.
Partial sums of A077868. - Paul Barry, Sep 16 2004

References

  • Chu, Hung Viet. "Various Sequences from Counting Subsets." Fib. Quart., 59:2 (May 2021), 150-157.

Crossrefs

Programs

  • Magma
    A050228:= func< n | n eq 0 select 0 else (&+[Binomial(n-2*j+1, j+2): j in [0..Floor((n+1)/3)]]) >;
    [A050228(n): n in [1..40]]; // G. C. Greubel, Jul 27 2022
    
  • Maple
    with(combstruct): SubSetSeqU := [T, {T=Subst(U,U), S=Set(U, card>=3), U=Sequence(Z, card>=3)}, unlabeled]: seq(count(SubSetSeqU, size=n), n=9..46); # Zerinvary Lajos, Mar 18 2008
  • Mathematica
    Rest[CoefficientList[Series[1/((1-x)^2*(1-x-x^3)), {x, 0, 50}], x]] (* G. C. Greubel, Apr 27 2017 *)
    LinearRecurrence[{3,-3,2,-2,1},{1,3,6,11,19},50] (* Harvey P. Dale, Apr 21 2020 *)
  • PARI
    my(x='x+O('x^50)); Vec(x/((1-x)^3-x^3*(1-x)^2)) \\ G. C. Greubel, Apr 27 2017
    
  • SageMath
    def A050228(n): return sum(binomial(n-2*j+1, j+2) for j in (0..((n+1)//3)))
    [A050228(n) for n in (1..40)] # G. C. Greubel, Jul 27 2022

Formula

From Paul Barry, Sep 16 2004: (Start)
G.f.: x/((1-x)^3 - x^3(1-x)^2).
a(n) = 3*a(n-1) - 3*a(n-2) + 2*a(n-3) - 2*a(n-4) + a(n-5).
a(n-1) = Sum_{k=0..floor(n/3)} binomial(n-2*k, k+2). (End)
G.f. = 1/((1-x)^2*(1-x-x^3)). - N. J. A. Sloane, Jun 02 2021
a(n) = A000930(n+5) - n - 4. - Greg Dresden, Jun 20 2021
From G. C. Greubel, Jul 27 2022: (Start)
a(n) = Sum_{j=0..floor((n+1)/3)} binomial(n-2*j+1, j+2).
a(n) = A099567(n+1, 2). (End)

A135851 a(n) = n-1, if n <= 2, otherwise A107458(n-1) + A107458(n-2).

Original entry on oeis.org

-1, 0, 1, 0, 0, 1, 1, 1, 2, 3, 4, 6, 9, 13, 19, 28, 41, 60, 88, 129, 189, 277, 406, 595, 872, 1278, 1873, 2745, 4023, 5896, 8641, 12664, 18560, 27201, 39865, 58425, 85626, 125491, 183916, 269542, 395033, 578949, 848491, 1243524, 1822473, 2670964, 3914488, 5736961, 8407925
Offset: 0

Views

Author

N. J. A. Sloane, Mar 08 2008

Keywords

Examples

			G.f. = -1 + x^2 + x^5 + x^6 + x^7 + 2*x^8 + 3*x^9 + 4*x^10 + 6*x^11 + ...
		

Crossrefs

Programs

  • Haskell
    a135851 n = a135851_list !! n
    a135851_list = -1 : 0 : 1 : zipWith (+) a135851_list (drop 2 a135851_list)
    -- Reinhard Zumkeller, Mar 23 2012
    
  • Magma
    [n le 3 select n-2 else Self(n-1) + Self(n-3): n in [1..61]]; // G. C. Greubel, Aug 01 2022
    
  • Mathematica
    LinearRecurrence[{1,0,1},{-1,0,1},50] (* Vladimir Joseph Stephan Orlovsky, Jan 31 2012 *)
    a[ n_] := If[ n < 3, SeriesCoefficient[ 1 / (1 + x^2 - x^3), {x, 0, 2 - n}], SeriesCoefficient[ x^5 / (1 - x - x^3), {x, 0, n}]]; (* Michael Somos, Jan 08 2014 *)
  • PARI
    {a(n) = if( n<3, polcoeff( 1 / (1 + x^2 - x^3) + x * O(x^(2-n)), 2-n), polcoeff( x^5 / (1 - x - x^3) + x * O(x^n), n))}; /* Michael Somos, Jan 08 2014 */
    
  • SageMath
    def A000930(n): return sum(binomial(n-2*j,j) for j in (0..(n//3)))
    def A135851(n): return A000930(n+2) -2*A000930(n)
    [A135851(n) for n in (0..60)] # G. C. Greubel, Aug 01 2022

Formula

From R. J. Mathar, Jul 26 2010: (Start)
a(n) = +a(n-1) +a(n-3).
a(n) = A078012(n-2), for n>=2.
G.f.: (-1 + x + x^2) / (1 - x - x^3). (End)
From Michael Somos, Jan 08 2014: (Start)
a(n) = A077961(2-n) for all n in Z.
a(n)^2 - a(n-1)*a(n+1) = A077961(n-5). (End)
a(n) = A000930(n+2) - 2*A000930(n). - G. C. Greubel, Aug 01 2022

A353400 Number of integer compositions of n with all run-lengths > 2.

Original entry on oeis.org

1, 0, 0, 1, 1, 1, 2, 1, 2, 4, 4, 5, 11, 11, 14, 27, 29, 37, 61, 72, 97, 147, 181, 246, 368, 470, 632, 914, 1198, 1611, 2286, 3018, 4079, 5709, 7619, 10329, 14333, 19258, 26142, 36069, 48688, 66114, 90800, 122913, 167020, 228735, 310167, 421708, 576499, 782803
Offset: 0

Views

Author

Gus Wiseman, May 15 2022

Keywords

Examples

			The a(7) = 1 through a(12) = 11 compositions:
  1111111   2222       333         22222        1112222       444
            11111111   111222      1111222      2222111       3333
                       222111      2221111      11111222      111333
                       111111111   1111111111   22211111      222222
                                                11111111111   333111
                                                              11112222
                                                              22221111
                                                              111111222
                                                              111222111
                                                              222111111
                                                              111111111111
		

Crossrefs

The = 2 version is A003242 aerated.
The <= 1 version is A003242 ranked by A333489.
The version for parts instead of run-lengths is A078012, both A353428.
The version for partitions is A100405.
The > 1 version is A114901, ranked by A353427.
The <= 2 version is A128695, matching A335464.
A008466 counts compositions with some part > 2.
A011782 counts compositions.
A106356 counts compositions by number of adjacent equal parts.
A274174 counts compositions with equal parts contiguous.
A329738 counts uniform compositions, partitions A047966.
A329739 counts compositions with all distinct run-lengths.

Programs

  • Maple
    b:= proc(n, h) option remember; `if`(n=0, 1, add(
         `if`(i<>h, add(b(n-i*j, i), j=3..n/i), 0), i=1..n/3))
        end:
    a:= n-> b(n, 0):
    seq(a(n), n=0..50);  # Alois P. Heinz, May 17 2022
  • Mathematica
    Table[Length[Select[Join@@Permutations/@ IntegerPartitions[n],!MemberQ[Length/@Split[#],1|2]&]],{n,0,15}]

Extensions

a(21)-a(49) from Alois P. Heinz, May 17 2022
Showing 1-10 of 35 results. Next