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

A385407 Number of strings of length n defined on {0, 1, 2, 3} that contain one or no 1's, two or no 2's, three or no 3's and any number of 0's.

Original entry on oeis.org

1, 2, 4, 11, 31, 86, 282, 939, 2781, 7186, 16496, 34387, 66299, 119926, 205766, 337731, 533817, 816834, 1215196, 1763771, 2504791, 3488822, 4775794, 6436091, 8551701, 11217426, 14542152, 18650179, 23682611, 29798806, 37177886, 46020307, 56549489, 69013506, 83686836, 100872171
Offset: 0

Views

Author

Enrique Navarrete, Jun 27 2025

Keywords

Examples

			a(2) = 4 since the strings are 01, 10, 22, 00.
a(3) = 11 since the strings are 333, 000, the 3 permutations of 122, the 3 permutations of 100, and the 3 permutations of 220.
		

Crossrefs

Cf. A385312.

Programs

  • Mathematica
    LinearRecurrence[{7, -21, 35, -35, 21, -7, 1}, {1, 2, 4, 11, 31, 86, 282}, 36] (* Amiram Eldar, Jun 28 2025 *)
  • Python
    def A385407(n): return n*(n*(n*(n*(n*(n-14)+77)-194)+228)-86)//12+1 # Chai Wah Wu, Jul 02 2025

Formula

a(n) = 60*binomial(n,6) + 10*binomial(n,5) + 4*binomial(n,4) + 4*binomial(n,3) + binomial(n,2) + n + 1.
a(n) = 1 - (43/6)*n + 19*n^2 - (97/6)*n^3 + (77/12)*n^4 - (7/6)*n^5 + (1/12)*n^6.
G.f.: (51*x^6 + 9*x^5 + 3*x^4 - 10*x^3 + 11*x^2 - 5*x + 1)/(1-x)^7.
E.g.f.: exp(x)*(1+x)*(1+x^2/2)*(1+x^3/6).

A387185 a(n) = n*2^(n-1) + binomial(n,2)*2^(n-2) + binomial(n,3)*2^(n-3).

Original entry on oeis.org

0, 1, 5, 19, 64, 200, 592, 1680, 4608, 12288, 32000, 81664, 204800, 505856, 1232896, 2969600, 7077888, 16711680, 39124992, 90898432, 209715200, 480772096, 1095761920, 2484076544, 5603590144, 12582912000, 28135391232, 62662901760, 139049566208, 307492814848, 677799526400
Offset: 0

Views

Author

Enrique Navarrete, Aug 21 2025

Keywords

Comments

Number of ternary strings of length n that contain one, two or three 0's.
Number of words of length n defined on five letters that contain one a or 2 b's or 3 c's and any number of d's and e's.

Examples

			a(3) = 19 since the words are (number of permutations in parentheses): add (3), ade (6), aee (3), bbd (3), bbe (3), ccc (1).
a(4) = 64 since from the 81 strings of length 4 we subtract the following 17 (number of permutations in parentheses): 0000 (1), 1111 (1), 1112 (4), 1122 (6), 1222 (4), 2222 (1).
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Sum[2^(n-k)*Binomial[n, k], {k, 1, 3}]; Array[a, 30, 0] (* Amiram Eldar, Aug 21 2025 *)

Formula

E.g.f.: (1 + x/2 + x^2/6)*x*exp(2*x).
G.f.: x*(1-3*x+3*x^2)/(2*x-1)^4 . - R. J. Mathar, Aug 26 2025
a(n) = n*2^n*(20+3*n+n^2)/48. - R. J. Mathar, Aug 26 2025
Showing 1-2 of 2 results.