A006367
Number of binary vectors of length n+1 beginning with 0 and containing just 1 singleton.
Original entry on oeis.org
1, 0, 2, 2, 5, 8, 15, 26, 46, 80, 139, 240, 413, 708, 1210, 2062, 3505, 5944, 10059, 16990, 28646, 48220, 81047, 136032, 228025, 381768, 638450, 1066586, 1780061, 2968040, 4944519, 8230370, 13689118, 22751528, 37786915, 62716752, 104028245
Offset: 0
a(4) = 5 because among the 2^4 compositions of 5 only 4+1,1+4,2+2+1,2+1+2,1+2+2 contain exactly one 1.
a(4) = 5 because the binary vectors of length 4+1 beginning with 0 and with exactly one singleton are: 00001, 00100, 00110, 01100, 01111. - _Michael Somos_, Nov 29 2014
G.f. = 1 + 2*x^2 + 2*x^3 + 5*x^4 + 8*x^5 + 15*x^6 + 26*x^7 + 46*x^8 + ...
- Vincenzo Librandi, Table of n, a(n) for n = 0..1000
- Ricardo Gómez Aíza, Symbolic dynamical scales: modes, orbitals, and transversals, arXiv:2009.02669 [math.DS], 2020.
- Jia Huang, Partially Palindromic Compositions, J. Int. Seq. (2023) Vol. 26, Art. 23.4.1. See pp. 4, 11.
- Mengmeng Liu and Andrew Yezhou Wang, The Number of Designated Parts in Compositions with Restricted Parts, J. Int. Seq., Vol. 23 (2020), Article 20.1.8.
- J. J. Madden, A generating function for the distribution of runs in binary words, arXiv:1707.04351 [math.CO], 2017, Theorem 1.1, r=k=1.
- T. Mansour and A. Robertson, Refined restricted permutations avoiding subsets of patterns of length three, arXiv:math/0204005 [math.CO], 2002.
- Index entries for linear recurrences with constant coefficients, signature (2,1,-2,-1).
-
I:=[1,0]; [n le 2 select I[n] else Self(n-1)+Self(n-2)+Fibonacci(n-3): n in [1..40]]; // Vincenzo Librandi, Feb 20 2014
-
nn=36; CoefficientList[Series[1/(1 -x/(1-x) +x)^2, {x, 0, nn}], x] (* Geoffrey Critzer, Feb 18 2014 *)
a[n_]:= If[ n<0, SeriesCoefficient[((1-x)/(1+x-x^2))^2, {x, 0, -2-n}], SeriesCoefficient[((1-x)/(1-x-x^2))^2, {x, 0, n}]]; (* Michael Somos, Nov 29 2014 *)
-
Vec( (1-x)^2/(1-x-x^2)^2 + O(x^66) ) \\ Joerg Arndt, Feb 20 2014
-
{a(n) = if( n<0, n = -2-n; polcoeff( (1 - x)^2 / (1 + x - x^2)^2 + x * O(x^n), n), polcoeff( (1 - x)^2 / (1 - x - x^2)^2 + x * O(x^n), n))}; /* Michael Somos, Nov 29 2014 */
-
from sympy import fibonacci
from sympy.core.cache import cacheit
@cacheit
def a(n): return 1 if n==0 else 0 if n==1 else a(n - 1) + a(n - 2) + fibonacci(n - 3)
print([a(n) for n in range(51)]) # Indranil Ghosh, Jul 20 2017
-
def A006367(n): return (1/5)*(n*lucas_number2(n-2, 1, -1) + fibonacci(n+1) + 4*fibonacci(n-1))
[A006367(n) for n in (0..40)] # G. C. Greubel, Apr 06 2022
A105423
Number of compositions of n+2 having exactly two parts equal to 1.
Original entry on oeis.org
1, 0, 3, 3, 9, 15, 31, 57, 108, 199, 366, 666, 1205, 2166, 3873, 6891, 12207, 21537, 37859, 66327, 115842, 201743, 350412, 607140, 1049545, 1810428, 3116655, 5355219, 9185349, 15728547, 26890375, 45904773, 78253896, 133221079
Offset: 0
a(4)=9 because we have (1,1,4),(1,4,1),(4,1,1),(1,1,2,2),(1,2,1,2),(1,2,2,1),(2,1,1,2),(2,1,2,1) and (2,2,1,1).
- Jia Huang, Partially Palindromic Compositions, J. Int. Seq. (2023) Vol. 26, Art. 23.4.1. See pp. 4, 11.
- J. J. Madden, A generating function for the distribution of runs in binary words, arXiv:1707.04351 [math.CO], 2017. Theorem 1.1, r=1, k=2.
- Index entries for linear recurrences with constant coefficients, signature (3, 0, -5, 0, 3, 1).
-
G:=(1-z)^3/(1-z-z^2)^3: Gser:=series(G,z=0,42): 1,seq(coeff(Gser,z^n),n=1..40);
-
LinearRecurrence[{3, 0, -5, 0, 3, 1}, {1, 0, 3, 3, 9, 15}, 40] (* Jean-François Alcover, Jul 23 2018 *)
A114320
Triangle T(n,k) = number of permutations of n elements with k 2-cycles.
Original entry on oeis.org
1, 1, 1, 1, 3, 3, 15, 6, 3, 75, 30, 15, 435, 225, 45, 15, 3045, 1575, 315, 105, 24465, 12180, 3150, 420, 105, 220185, 109620, 28350, 3780, 945, 2200905, 1100925, 274050, 47250, 4725, 945, 24209955, 12110175, 3014550, 519750, 51975, 10395, 290529855
Offset: 0
T(3,1) = 3 because we have (1)(23), (12)(3) and (13)(2).
Triangle begins:
1;
1;
1, 1;
3, 3;
15, 6, 3;
75, 30, 15;
435, 225, 45, 15;
...
-
G:= exp((y-1)*x^2/2)/(1-x): Gser:= simplify(series(G,x=0,15)): P[0]:=1: for n from 1 to 12 do P[n]:= n!*coeff(Gser,x^n) od: for n from 0 to 12 do seq(coeff(y*P[n], y^j), j=1..1+floor(n/2)) od; # yields sequence in triangular form - Emeric Deutsch, Feb 17 2006
-
d = Exp[-x^2/2!]/(1 - x);f[list_] := Select[list, # > 0 &]; Flatten[Map[f, Transpose[Table[Range[0, 10]!CoefficientList[Series[x^(2 k)/(2^k k!) d, {x, 0, 10}], x], {k, 0, 5}]]]] (* Geoffrey Critzer, Nov 29 2011 *)
A320341
Triangle read by rows: T(n,k) is the number of unmarked circular binary words (necklaces) of length n having k occurrences of the pattern 00 (n >= 0 and 0 <= k <= n).
Original entry on oeis.org
1, 1, 1, 2, 0, 1, 2, 1, 0, 1, 3, 1, 1, 0, 1, 3, 2, 1, 1, 0, 1, 5, 3, 3, 1, 1, 0, 1, 5, 5, 4, 3, 1, 1, 0, 1, 8, 8, 8, 5, 4, 1, 1, 0, 1, 10, 13, 13, 11, 6, 4, 1, 1, 0, 1, 15, 21, 24, 19, 14, 7, 5, 1, 1, 0, 1, 19, 34, 40, 36, 26, 17, 8, 5, 1, 1, 0, 1, 31, 55, 71, 67, 54, 34, 22, 9, 6, 1, 1, 0, 1
Offset: 0
Triangle for T(n,k) begins:
n=0: 1;
n=1: 1, 1;
n=2: 2, 0, 1;
n=3: 2, 1, 0, 1;
n=4: 3, 1, 1, 0, 1;
n=5: 3, 2, 1, 1, 0, 1;
n=6: 5, 3, 3, 1, 1, 0, 1;
n=7: 5, 5, 4, 3, 1, 1, 0, 1;
n=8: 8, 8, 8, 5, 4, 1, 1, 0, 1;
n=9: 10, 13, 13, 11, 6, 4, 1, 1, 0, 1;
n=10: 15, 21, 24, 19, 14, 7, 5, 1, 1, 0, 1;
...
If we take the Taylor expansion of g.f. F(z,t) of T(n,k) around z=0, we get F(z,t) = 1 + (1+t)*z + (2+0*t+t^2)*z^2 + (2+t+0*t^2+t^3)*z^3 + (3+t+t^2+0*t^3+t^4)*z^4 + (3+2*t+t^2+t^3+0*t^4+t^5)*z^5 + ...
For example, for n=4, we have the following marked and unmarked circular binary words (the square brackets denote equivalence classes):
k=0: [1111], [1110,1101,1011,0111], [1010,0101], V(4,0) = 7 and T(4,0) = 3;
k=1: [1100,1001,0011,0110], V(4,1) = 4 and T(4,1) = 1;
k=2: [0001,0010,0100,1000], V(4,2) = 4 and T(4,2) = 1;
k=3: none, V(4,3) = 0 = T(4,3);
k=4: [0000], V(4,4) = 1 = T(4,4).
The corresponding cyclic compositions of n=4 under MacMahon's bijection are the following:
k=0 (no 1's): [none], [4], [2+2], T(4,1) - 1 = 3 - 1 = 2;
k=1 (one 1): [1+3], T(4,1) = 1;
k=2 (two 1's): [1+1+2], T(4,2) = 1;
k=3 (three 1's): none, T(4,3) = 0;
k=4 (four 1's): [1+1+1+1], T(4,4) = 1.
- L. Carlitz and R. Scoville, Zero-one sequences and Fibonacci numbers, Fibonacci Quarterly, 15 (1977), 246-254.
- P. Flajolet and R. Sedgewick, Analytic Combinatorics, 2009.
- P. Flajolet and M. Soria, The Cycle Construction, SIAM J. Discr. Math., vol. 4 (1), 1991, pp. 58-60.
- P. Flajolet and M. Soria, The Cycle Construction, SIAM J. Discr. Math., vol. 4 (1), 1991, pp. 58-60.
- P. Hadjicostas and L. Zhang, On cyclic strings avoiding a pattern, Discrete Mathematics, 341 (2018), 1662-1674.
- L. Zhang and P. Hadjicostas, On sequences of independent Bernoulli trials avoiding the pattern '11..1', Math. Scientist, 40 (2015), 89-96.
A113979
Number of compositions of n with an even number of 1's.
Original entry on oeis.org
1, 0, 2, 1, 6, 6, 20, 28, 72, 120, 272, 496, 1056, 2016, 4160, 8128, 16512, 32640, 65792, 130816, 262656, 523776, 1049600, 2096128, 4196352, 8386560, 16781312, 33550336, 67117056, 134209536, 268451840, 536854528, 1073774592, 2147450880
Offset: 0
a(4)=6 because the compositions of 4 having an even number of 1's are 4,22,211,121,112 and 1111 (the other compositions of 4 are 31 and 13).
Cf.
A063376,
A006516,
A063083,
A100818,
A092295,
A111752,
A111753,
A111723,
A111724,
A088336,
A088506.
-
a:=proc(n) if n mod 2 = 0 then 2^(n-2)+2^((n-2)/2) else 2^(n-2)-2^((n-3)/2) fi end: seq(a(n),n=1..38); # Emeric Deutsch, Feb 01 2006
-
f[n_] := If[ EvenQ[n], 2^(n - 2) + 2^((n - 2)/2), 2^(n - 2) - 2^((n - 3)/2)]; Array[f, 34] (* Robert G. Wilson v, Feb 01 2006 *)
-
a(n) = n-=2; (n==-2) + 1<=0, (-1)^n << (n>>1)); \\ Kevin Ryde, May 02 2023
a(0)=1 prepended and formulas corrected by
Jason Yuen, Sep 09 2024
A222763
Number of n X 2 0..1 arrays with exactly floor(nX2/2) elements unequal to at least one horizontal or antidiagonal neighbor, with new values introduced in row major 0..1 order.
Original entry on oeis.org
1, 0, 3, 4, 20, 48, 175, 512, 1719, 5400, 17776, 57420, 188656, 617176, 2033175, 6697744, 22139780, 73262232, 242931321, 806516560, 2681475048, 8925158440, 29740390672, 99196158144, 331163178475, 1106489052968, 3699881730900, 12380449027324, 41454579098852
Offset: 0
All solutions for n=3
..0..1....0..0....0..0....0..0
..0..0....0..0....0..1....1..0
..0..0....1..0....0..0....0..0
-
a:= proc(n) option remember; `if`(n<3, [1, 0, 3][n+1],
(4*(n-1)*(74*n^2-153*n+73)*a(n-1) +8*(2*n-3)*
(74*n^2-153*n+70)*a(n-2) -2*(37*n-21)*(2*n-5)*
(n-1)*a(n-3))/(5*(37*n-58)*n*(n-1)))
end:
seq(a(n), n=0..30); # Alois P. Heinz, Sep 24 2024
A383101
Number of compositions of n such that any part 1 can be m different colors where m is the largest part of the composition.
Original entry on oeis.org
1, 1, 2, 6, 21, 77, 294, 1178, 4978, 22191, 104146, 513385, 2653003, 14349804, 81125023, 478686413, 2943737942, 18838530436, 125268429098, 864256288435, 6177766228172, 45689641883377, 349173454108407, 2754058599745239, 22393206702946457, 187501022603071090
Offset: 0
a(3) = 6 counts: (3), (2,1_a), (2,1_b), (1_a,2), (1_b,2), (1_a,1_a,1_a).
-
b:= proc(n, p, m) option remember; binomial(n+p, n)*
m^n+add(b(n-j, p+1, max(m, j)), j=2..n)
end:
a:= n-> b(n, 0, 1):
seq(a(n), n=0..25); # Alois P. Heinz, Apr 23 2025
-
A_x(N) = {my(x='x+O('x^N)); Vec(1+sum(m=1,N, x^m/((1-m*x-(x^2-x^m)/(1-x))*(1-m*x-(x^2-x^(m+1))/(1-x)))))}
A_x(30)
A113980
Number of compositions of n with an odd number of 1's.
Original entry on oeis.org
1, 0, 3, 2, 10, 12, 36, 56, 136, 240, 528, 992, 2080, 4032, 8256, 16256, 32896, 65280, 131328, 261632, 524800, 1047552, 2098176, 4192256, 8390656, 16773120, 33558528, 67100672, 134225920, 268419072, 536887296, 1073709056, 2147516416
Offset: 1
a(4)=2 because only the compositions 31 and 13 of 4 have an odd number of 1's (the other compositions are 4,22,211,121,112 and 1111).
Cf.
A020522,
A007582,
A063083,
A100818,
A092295,
A111752,
A111753,
A111723,
A111724,
A088336,
A088506.
-
a:=proc(n) if n mod 2 = 0 then 2^(n-2)-2^((n-2)/2) else 2^(n-2)+2^((n-3)/2) fi end: seq(a(n),n=1..38); # Emeric Deutsch, Feb 01 2006
-
f[n_] := If[EvenQ[n], 2^(n - 2) - 2^((n - 2)/2), 2^(n - 2) + 2^((n - 3)/2)]; Array[f, 34] (* Robert G. Wilson v, Feb 01 2006 *)
A296559
Triangle read by rows: T(n,k) is the number of compositions of n having k parts equal to 1 or 2 (0<=k<=n).
Original entry on oeis.org
1, 0, 1, 0, 1, 1, 1, 0, 2, 1, 1, 2, 1, 3, 1, 1, 4, 3, 3, 4, 1, 2, 4, 9, 5, 6, 5, 1, 3, 7, 12, 16, 9, 10, 6, 1, 4, 13, 18, 28, 26, 16, 15, 7, 1, 6, 19, 36, 42, 55, 41, 27, 21, 8, 1, 9, 29, 60, 82, 90, 97, 64, 43, 28, 9, 1, 13, 47, 94, 152, 170, 177, 160, 99, 65, 36, 10, 1, 19, 73, 158, 252, 335, 333, 323, 253, 151, 94, 45, 11, 1
Offset: 0
T(3,2) = 2 because we have [1,2],[2,1].
T(6,3) = 5 because we have [2,2,2],[1,1,1,3],[1,1,3,1],[1,3,1,1],[3,1,1,1].
Triangle begins:
1,
0, 1,
0, 1, 1,
1, 0, 2, 1,
1, 2, 1, 3, 1,
1, 4, 3, 3, 4, 1,
2, 4, 9, 5, 6, 5, 1,
3, 7, 12, 16, 9, 10, 6, 1,
4, 13, 18, 28, 26, 16, 15, 7, 1,
...
-
g := (1-x)/(1-(1+t)*x-(1-t)*x^3): gser := simplify(series(g, x = 0, 17)): for n from 0 to 15 do p[n] := sort(expand(coeff(gser, x, n))) end do: for n from 0 to 15 do seq(coeff(p[n], t, j), j = 0 .. n) end do; # yields sequence in triangular form
-
nmax = 12;
s = Series[(1-x)/(1 - (1+t) x - (1-t) x^3), {x, 0, nmax}, {t, 0, nmax}];
T[n_, k_] := SeriesCoefficient[s, {x, 0, n}, {t, 0, k}];
Table[T[n, k], {n, 0, nmax}, {k, 0, n}] // Flatten (* Jean-François Alcover, Dec 16 2017 *)
Showing 1-9 of 9 results.
Comments