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-8 of 8 results.

A102866 Number of finite languages over a binary alphabet (set of nonempty binary words of total length n).

Original entry on oeis.org

1, 2, 5, 16, 42, 116, 310, 816, 2121, 5466, 13937, 35248, 88494, 220644, 546778, 1347344, 3302780, 8057344, 19568892, 47329264, 114025786, 273709732, 654765342, 1561257968, 3711373005, 8797021714, 20794198581, 49024480880, 115292809910, 270495295636
Offset: 0

Views

Author

Philippe Flajolet, Mar 01 2005

Keywords

Comments

Analogous to A034899 (which also enumerates multisets of words)

Examples

			a(2) = 5 because the sets are {a,b}, {aa}, {ab}, {ba}, {bb}.
a(3) = 16 because the sets are {a,aa}, {a,ab}, {a,ba}, {a,bb}, {b,aa}, {b,ab}, {b,ba}, {b,bb}, {aaa}, {aab}, {aba}, {abb}, {baa}, {bab}, {bba}, {bbb}.
		

Crossrefs

Column k=2 of A292804.
Row sums of A208741 and of A360634.

Programs

  • Maple
    series(exp(add((-1)^(j-1)/j*(2*z^j)/(1-2*z^j),j=1..40)),z,40);
  • Mathematica
    nn = 20; p = Product[(1 + x^i)^(2^i), {i, 1, nn}]; CoefficientList[Series[p, {x, 0, nn}], x] (* Geoffrey Critzer, Mar 07 2012 *)
    CoefficientList[Series[E^Sum[(-1)^(k-1)/k*(2*x^k)/(1-2*x^k), {k,1,30}], {x, 0, 30}], x] (* Vaclav Kotesovec, Sep 13 2014 *)

Formula

G.f.: exp(Sum((-1)^(j-1)/j*(2*z^j)/(1-2*z^j), j=1..infinity)).
Asymptotics (Gerhold, 2011): a(n) ~ c * 2^(n-1)*exp(2*sqrt(n)-1/2) / (sqrt(Pi) * n^(3/4)), where c = exp( Sum_{k>=2} (-1)^(k-1)/(k*(2^(k-1)-1)) ) = 0.6602994483152065685... . - Vaclav Kotesovec, Sep 13 2014
Weigh transform of A000079. - Alois P. Heinz, Jun 25 2018

A293815 Number T(n,k) of sets of exactly k nonempty words with a total of n letters over n-ary alphabet such that within each prefix of a word every letter of the alphabet is at least as frequent as the subsequent alphabet letter; triangle T(n,k), n>=0, read by rows.

Original entry on oeis.org

1, 0, 1, 0, 2, 0, 4, 2, 0, 10, 5, 0, 26, 18, 1, 0, 76, 52, 8, 0, 232, 168, 30, 0, 764, 533, 114, 4, 0, 2620, 1792, 411, 22, 0, 9496, 6161, 1462, 116, 0, 35696, 22088, 5237, 482, 6, 0, 140152, 81690, 18998, 1966, 48, 0, 568504, 313224, 70220, 7682, 274
Offset: 0

Views

Author

Alois P. Heinz, Oct 16 2017

Keywords

Comments

The smallest nonzero term in column k is A291057(k).

Examples

			T(0,0) = 1: {}.
T(3,1) = 4: {aaa}, {aab}, {aba}, {abc}.
T(3,2) = 2: {a,aa}, {a,ab}.
T(4,2) = 5: {a,aaa}, {a,aab}, {a,aba}, {a,abc}, {aa,ab}.
T(5,3) = 1: {a,aa,ab}.
Triangle T(n,k) begins:
  1;
  0,      1;
  0,      2;
  0,      4,     2;
  0,     10,     5;
  0,     26,    18,     1;
  0,     76,    52,     8;
  0,    232,   168,    30;
  0,    764,   533,   114,    4;
  0,   2620,  1792,   411,   22;
  0,   9496,  6161,  1462,  116;
  0,  35696, 22088,  5237,  482,  6;
  0, 140152, 81690, 18998, 1966, 48;
  ...
		

Crossrefs

Columns k=0-10 give: A000007, A000085 (for n>0), A293964, A293965, A293966, A293967, A293968, A293969, A293970, A293971, A293972.
Row sums give A293114.

Programs

  • Maple
    g:= proc(n) option remember; `if`(n<2, 1, g(n-1)+(n-1)*g(n-2)) end:
    b:= proc(n, i) option remember; expand(`if`(n=0, 1, `if`(i<1, 0,
          add(b(n-i*j, i-1)*binomial(g(i), j)*x^j, j=0..n/i))))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n$2)):
    seq(T(n), n=0..15);
  • Mathematica
    g[n_] := g[n] = If[n < 2, 1, g[n - 1] + (n - 1)*g[n - 2]];
    b[n_, i_] := b[n, i] = Expand[If[n == 0, 1, If[i<1, 0, Sum[b[n - i*j, i-1]* Binomial[g[i], j]*x^j, {j, 0, n/i}]]]];
    T[n_] := Function[p, Table[Coefficient[p, x, i], {i, 0, Exponent[p, x]}]][ b[n, n]];
    Table[T[n], {n, 0, 15}] // Flatten (* Jean-François Alcover, Jun 04 2018, from Maple *)

Formula

G.f.: Product_{j>=1} (1+y*x^j)^A000085(j).

A209406 Triangular array read by rows: T(n,k) is the number of multisets of exactly k nonempty binary words with a total of n letters.

Original entry on oeis.org

2, 4, 3, 8, 8, 4, 16, 26, 12, 5, 32, 64, 44, 16, 6, 64, 164, 132, 62, 20, 7, 128, 384, 376, 200, 80, 24, 8, 256, 904, 1008, 623, 268, 98, 28, 9, 512, 2048, 2632, 1792, 870, 336, 116, 32, 10, 1024, 4624, 6624, 5040, 2632, 1117, 404, 134, 36, 11
Offset: 1

Views

Author

Geoffrey Critzer, Mar 08 2012

Keywords

Comments

Equivalently, T(n,k) is the number of partitions of the integer n with two types of 1's, four types of 2's, ..., 2^i types of i's...; having exactly k summands (of any type).
Row sums = A034899.

Examples

			Triangle T(n,k) begins:
    2;
    4,    3;
    8,    8,    4;
   16,   26,   12,    5;
   32,   64,   44,   16,   6;
   64,  164,  132,   62,  20,   7;
  128,  384,  376,  200,  80,  24,   8;
  256,  904, 1008,  623, 268,  98,  28,  9;
  512, 2048, 2632, 1792, 870, 336, 116, 32, 10;
  ...
		

Crossrefs

T(2n,n) gives A359962.

Programs

  • Maple
    b:= proc(n, i, p) option remember; `if`(p>n, 0, `if`(n=0, 1,
          `if`(min(i, p)<1, 0, add(b(n-i*j, i-1, p-j)*
           binomial(2^i+j-1, j), j=0..min(n/i, p)))))
        end:
    T:= (n, k)-> b(n$2, k):
    seq(seq(T(n, k), k=1..n), n=1..14);  # Alois P. Heinz, Apr 13 2017
  • Mathematica
    nn = 10; p[x_, y_] := Product[1/(1 - y x^i)^(2^i), {i, 1, nn}]; f[list_] := Select[lst, # > 0 &]; Map[f, Drop[CoefficientList[Series[p[x, y], {x, 0, nn}], {x, y}], 1]] // Flatten

Formula

O.g.f.: Product_{i>=1} 1/(1-y*x^i)^(2^i).

A360634 Number T(n,k) of sets of nonempty words over binary alphabet with a total of n letters of which k are the first letter; triangle T(n,k), n>=0, 0<=k<=n, read by rows.

Original entry on oeis.org

1, 1, 1, 1, 3, 1, 2, 6, 6, 2, 2, 11, 16, 11, 2, 3, 18, 37, 37, 18, 3, 4, 28, 73, 100, 73, 28, 4, 5, 42, 133, 228, 228, 133, 42, 5, 6, 61, 227, 470, 593, 470, 227, 61, 6, 8, 86, 370, 899, 1370, 1370, 899, 370, 86, 8, 10, 119, 580, 1617, 2894, 3497, 2894, 1617, 580, 119, 10
Offset: 0

Views

Author

Alois P. Heinz, Feb 14 2023

Keywords

Examples

			T(4,0) = 2: {bbbb}, {b,bbb}.
T(4,1) = 11: {abbb}, {babb}, {bbab}, {bbba}, {a,bbb}, {ab,bb}, {abb,b}, {b,bab}, {b,bba}, {ba,bb}, {a,b,bb}.
T(4,2) = 16: {aabb}, {abab}, {abba}, {baab}, {baba}, {bbaa}, {a,abb}, {a,bab}, {a,bba}, {aa,bb}, {aab,b}, {ab,ba}, {aba,b}, {b,baa}, {a,ab,b}, {a,b,ba}.
Triangle T(n,k) begins:
   1;
   1,   1;
   1,   3,   1;
   2,   6,   6,    2;
   2,  11,  16,   11,    2;
   3,  18,  37,   37,   18,    3;
   4,  28,  73,  100,   73,   28,    4;
   5,  42, 133,  228,  228,  133,   42,    5;
   6,  61, 227,  470,  593,  470,  227,   61,   6;
   8,  86, 370,  899, 1370, 1370,  899,  370,  86,   8;
  10, 119, 580, 1617, 2894, 3497, 2894, 1617, 580, 119, 10;
  ...
		

Crossrefs

Columns k=0-2 give: A000009, A095944, A360650.
Row sums give A102866.
T(2n,n) gives A360638.
Cf. A055375 (the same for multisets), A200751, A208741.

Programs

  • Maple
    g:= proc(n, i, j) option remember; expand(`if`(j=0, 1, `if`(i<0, 0, add(
          g(n, i-1, j-k)*x^(i*k)*binomial(binomial(n, i), k), k=0..j))))
        end:
    b:= proc(n, i) option remember; expand(`if`(n=0, 1,
         `if`(i<1, 0, add(b(n-i*j, i-1)*g(i$2, j), j=0..n/i))))
        end:
    T:= (n, k)-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n$2)):
    seq(T(n), n=0..15);
  • Mathematica
    g[n_, i_, j_] := g[n, i, j] = Expand[If[j == 0, 1, If[i < 0, 0, Sum[g[n, i - 1, j - k]*x^(i*k)*Binomial[Binomial[n, i], k], {k, 0, j}]]]];
    b[n_, i_] := b[n, i] = Expand[If[n == 0, 1, If[i < 1, 0, Sum[b[n - i*j, i - 1]*g[i, i, j], {j, 0, n/i}]]]];
    T[n_] := CoefficientList[b[n, n], x];
    Table[T[n], {n, 0, 15}] // Flatten (* Jean-François Alcover, Dec 05 2023, after Alois P. Heinz *)

Formula

T(n,k) = T(n,n-k).
Sum_{k=0..2n} (-1)^k*T(2n,k) = A200751(n). - Alois P. Heinz, Sep 09 2023

A208742 Number of subsets of the set {1,2,...,n} which do not contain two elements whose difference is 5.

Original entry on oeis.org

1, 2, 4, 8, 16, 32, 48, 72, 108, 162, 243, 405, 675, 1125, 1875, 3125, 5000, 8000, 12800, 20480, 32768, 53248, 86528, 140608, 228488, 371293, 599781, 968877, 1565109, 2528253, 4084101, 6612354, 10705716, 17333064, 28063056, 45435424, 73498480, 118894600
Offset: 0

Views

Author

David Nacin, Mar 01 2012

Keywords

Examples

			If n=6 then we must count all subsets not containing both 1 and 6.  There are 2^4 subsets containing 1 and 6, giving us 2^6 - 2^4 = 48.  Thus a(6) = 48.
		

References

  • M. El-Mikkawy, T. Sogabe, A new family of k-Fibonacci numbers, Appl. Math. Comput. 215 (2010) 4456-4461 doi:10.1016/j.amc.2009.12.069, Table 1 k=5.

Crossrefs

Programs

  • Mathematica
    Table[Fibonacci[Floor[n/5] + 3]^Mod[n, 5] * Fibonacci[Floor[n/5] + 2]^(5 - Mod[n, 5]), {n, 1, 40}]
    LinearRecurrence[{1, 1, 0, 0, -3, 3, 3, 0, 0, 6, -6, -6, 0, 0, 3, -3, -3, 0, 0, -1, 1, 1}, {2, 4, 8, 16, 32, 48, 72, 108, 162, 243, 405, 675, 1125, 1875, 3125, 5000, 8000, 12800, 20480, 32768, 53248, 86528, 140608, 228488, 371293, 599781, 968877}, 80]
  • PARI
    a(n)=fibonacci(n\5+3)^(n%5)*fibonacci(n\5+2)^(5-n%5) \\ Charles R Greathouse IV, Mar 05 2012

Formula

a(n) = F(floor(n/5) + 3)^(n mod 5)*F(floor(n/5) + 2)^(5 - (n mod 5)) where F(n) is the n-th Fibonacci number.
a(n) = a(n-1) + a(n-2) - 3*a(n-5) + 3*a(n-6) + 3*a(n-7) + 6*a(n-10) - 6*a(n-11) - 6*a(n-12) + 3*a(n-15) - 3*a(n-16) - 3*a(n-17) - a(n-20) + a(n-21) + a(n-22).
G.f.: 1-x*(x^21 +2*x^20 +x^19 +x^18 +x^17 -2*x^16 -6*x^15 -4*x^14 -3*x^13 -3*x^12 -9*x^11 -12*x^10 -3*x^9 -6*x^8 -6*x^7 -2*x^6 +6*x^5 +8*x^4 +4*x^3 +2*x^2 +2*x +2) / ((x^2 +x -1) * (x^10 -4*x^5 -1) * (x^10 +x^5 -1)). - Colin Barker, Jun 02 2013

Extensions

a(0)=1 prepended by Alois P. Heinz, Sep 17 2024

A208743 Number of subsets of the set {1,2,...,n} which do not contain two elements whose difference is 6.

Original entry on oeis.org

2, 4, 8, 16, 32, 64, 96, 144, 216, 324, 486, 729, 1215, 2025, 3375, 5625, 9375, 15625, 25000, 40000, 64000, 102400, 163840, 262144, 425984, 692224, 1124864, 1827904, 2970344, 4826809, 7797153, 12595401, 20346417, 32867289, 53093313, 85766121, 138859434
Offset: 1

Views

Author

David Nacin, Mar 01 2012

Keywords

Examples

			If n=7 then we must count all subsets not containing both 1 and 7.  There are 2^5 subsets containing 1 and 7, giving us 2^7 - 2^5 = 48.  Thus a(7) = 96.
		

References

  • M. El-Mikkawy, T. Sogabe, A new family of k-Fibonacci numbers, Appl. Math. Comput. 215 (2010) 4456-4461 doi:10.1016/j.amc.2009.12.069, Table 1 k=6.

Crossrefs

Programs

  • Mathematica
    Table[Fibonacci[Floor[n/6] + 3]^Mod[n, 6] * Fibonacci[Floor[n/6] + 2]^(6 - Mod[n, 6]), {n, 1, 80}]
    LinearRecurrence[{1, 1, 0, 0, 0, -5, 5, 5, 0, 0, 0, 15, -15, -15, 0, 0, 0, 15, -15, -15, 0, 0, 0, -5, 5, 5, 0, 0, 0, -1, 1, 1}, {2, 4, 8, 16, 32, 64, 96, 144, 216, 324, 486, 729, 1215, 2025, 3375, 5625, 9375, 15625, 25000, 40000, 64000, 102400, 163840, 262144, 425984, 692224, 1124864, 1827904, 2970344, 4826809, 7797153, 12595401}, 80]
  • PARI
    Vec(x*(2 + 2*x + 2*x^2 + 4*x^3 + 8*x^4 + 16*x^5 + 10*x^6 - 6*x^7 - 14*x^8 - 16*x^9 - 14*x^10 - x^11 - 30*x^12 - 29*x^13 - 15*x^14 - 15*x^15 - 15*x^16 - 20*x^17 - 30*x^18 - 10*x^19 + 5*x^20 + 5*x^21 + 5*x^22 + 4*x^23 + 10*x^24 + 6*x^25 + x^26 + x^27 + x^28 + x^29 + 2*x^30 + x^31) / ((1 + x^2)*(1 - x - x^2)*(1 - x^2 + x^4)*(1 + x^3 - x^6)*(1 - x^3 - x^6)*(1 + 7*x^6 + x^12)) + O(x^30)) \\ Colin Barker, Feb 23 2017

Formula

a(n) = F(floor(n/6) + 3)^(n mod 6)*F(floor(n/6) + 2)^(6 - (n mod 6)) where F(n) is the n-th Fibonacci number.
a(n) = a(n-1) + a(n-2) - 5*a(n-6) + 5*a(n-7) + 5*a(n-8) + 15*a(n-12) - 15*a(n-13) - 15*a(n-14) + 15*a(n-18) - 15*a(n-19) - 15*a(n-20) - 5*a(n-24) + 5*a(n-25) + 5*a(n-26) - a(n-30) + a(n-31) + a(n-32).
G.f.: x*(2 + 2*x + 2*x^2 + 4*x^3 + 8*x^4 + 16*x^5 + 10*x^6 - 6*x^7 - 14*x^8 - 16*x^9 - 14*x^10 - x^11 - 30*x^12 - 29*x^13 - 15*x^14 - 15*x^15 - 15*x^16 - 20*x^17 - 30*x^18 - 10*x^19 + 5*x^20 + 5*x^21 + 5*x^22 + 4*x^23 + 10*x^24 + 6*x^25 + x^26 + x^27 + x^28 + x^29 + 2*x^30 + x^31) / ((1 + x^2)*(1 - x - x^2)*(1 - x^2 + x^4)*(1 + x^3 - x^6)*(1 - x^3 - x^6)*(1 + 7*x^6 + x^12)). - Colin Barker, Feb 23 2017

A209408 Number of subsets of {1,...,n} containing {a,a+4} for some a.

Original entry on oeis.org

0, 0, 0, 0, 0, 8, 28, 74, 175, 377, 799, 1673, 3471, 7192, 14784, 30208, 61440, 124416, 251328, 506712, 1020015, 2051015, 4119775, 8268215, 16582735, 33239558, 66599068, 133392344, 267099120, 534709192, 1070244924, 2141826898, 4285816671, 8575127217
Offset: 0

Views

Author

David Nacin, Mar 08 2012

Keywords

Comments

For n=5, subsets containing {a,a+4} occur only when a=1. There are 2^3 subsets including {1,5}, thus a(5) = 8.

Crossrefs

Programs

  • Magma
    [2^n - Fibonacci(Floor(n/4) + 2)*Fibonacci(Floor((n + 1)/4) + 2)*Fibonacci(Floor((n + 2)/4) + 2)*Fibonacci(Floor((n + 3)/4) + 2): n in [0..30]]; // G. C. Greubel, Jan 03 2018
  • Mathematica
    Table[2^n - Product[Fibonacci[Floor[(n + i)/4] + 2], {i, 0, 3}], {n, 0, 30}]
    LinearRecurrence[{3, -1, -2, -2, 6, -2, -4, 2, -6, 2, 4, 1, -3, 1, 2}, {0, 0, 0, 0, 0, 8, 28, 74, 175, 377, 799, 1673, 3471, 7192, 14784}, 30]
  • PARI
    for(n=0,20, print1(2^n - fibonacci(floor(n/4) + 2)*fibonacci( floor((n + 1)/4) + 2)*fibonacci(floor((n + 2)/4) + 2)*fibonacci( floor((n + 3)/4) + 2), ", ")) \\ G. C. Greubel, Jan 03 2018
    
  • Python
    #Returns the actual list of valid subsets
    def contains10001(n):
     patterns=list()
     for start in range (1,n-3):
      s=set()
      for i in range(5):
       if (1,0,0,0,1)[i]:
        s.add(start+i)
      patterns.append(s)
     s=list()
     for i in range(2,n+1):
      for temptuple in comb(range(1,n+1),i):
       tempset=set(temptuple)
       for sub in patterns:
        if sub <= tempset:
         s.append(tempset)
         break
     return s
    #Counts all such sets
    def countcontains10001(n):
     return len(contains10001(n))
    #From recurrence
    def a(n, adict={0:0, 1:0, 2:0, 3:0, 4:0, 5:8, 6:28, 7:74, 8:175, 9:377, 10:799, 11:1673, 12:3471, 13:7192, 14:14784}):
     if n in adict:
      return adict[n]
     adict[n]=3*a(n-1)-a(n-2)-2*a(n-3)-2*a(n-4)+6*a(n-5)-2*a(n-6)-4*a(n-7)+2*a(n-8)-6*a(n-9)+2*a(n-10)+4*a(n-11)+a(n-12)-3*a(n-13)+a(n-14)+2*a(n-15)
     return adict[n]
    

Formula

a(n) = 2^n - A208741(n-1).
a(n) = 2^n - Product_{i=0..3} Fibonacci(floor((n + i)/4) + 2).
a(n) = 3*a(n-1) - a(n-2) -2*a(n-3) -2*a(n-4) + 6*a(n-5) - 2*a(n-6) - 4*a(n-7) + 2*a(n-8) - 6*a(n-9) + 2*a(n-10) + 4*a(n-11) + a(n-12) - 3*a(n-13) + a(n-14) + 2*a(n-15).
G.f.: x^5*(8 + 4 x - 2 x^2 - 3 x^3 - 2 x^4 - x^5 - x^6 - x^7 - 2 x^8 - x^9) / ((1 - x) (1 + x) (1 - 2 x) (1 + x^2) (1 - x - x^2) (1 + 3 x^4 + x^8)).

A216158 The total number of nonempty words in all length n finite languages on an alphabet of two letters.

Original entry on oeis.org

0, 2, 6, 24, 72, 220, 652, 1848, 5160, 14130, 38102, 101296, 266328, 692740, 1785524, 4563888, 11577888, 29170128, 73032808, 181793136, 450100760, 1108868820, 2719167020, 6639085968, 16144137800, 39107596850, 94393612782, 227062741160, 544439640328, 1301446217244
Offset: 0

Views

Author

Geoffrey Critzer, Sep 03 2012

Keywords

Comments

A finite language is a set of distinct words with size being the total number of letters in all words.

Examples

			a(3) = 24 because the sets (languages) are {a,aa}; {a,ab}; {a,ba}; {a,bb}; {b,aa}; {b,ab}; {b,ba}; {b,bb}; {aaa}; {aab}; {aba}; {abb}; {baa}; {bab}; {bba}; {bbb} where the distinct words are separated by commas.
		

Crossrefs

Cf. A102866.

Programs

  • Maple
    h:= proc(n, i) option remember; `if`(n=0, [1, 0], `if`(i<1, 0, add(
          (p-> p+[0, p[1]*j])(binomial(2^i, j)*h(n-i*j, i-1)), j=0..n/i)))
        end:
    a:= n-> h(n$2)[2]:
    seq(a(n), n=0..30);  # Alois P. Heinz, Sep 24 2017
  • Mathematica
    nn=30;p=Product[(1+y x^i)^(2^i),{i,1,nn}];CoefficientList[Series[D[p,y]/.y->1,{x,0,nn}],x]

Formula

a(n) = Sum_{k>0} k * A208741(n,k).
Showing 1-8 of 8 results.