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.

A226881 Number of n-length binary words w with #(w,0) >= #(w,1) >= 1, where #(w,x) gives the number of digits x in w.

Original entry on oeis.org

0, 0, 2, 3, 10, 15, 41, 63, 162, 255, 637, 1023, 2509, 4095, 9907, 16383, 39202, 65535, 155381, 262143, 616665, 1048575, 2449867, 4194303, 9740685, 16777215, 38754731, 67108863, 154276027, 268435455, 614429671, 1073741823, 2448023842, 4294967295, 9756737701
Offset: 0

Views

Author

Alois P. Heinz, Jun 21 2013

Keywords

Comments

a(n) is the number of nonempty subsets of {1,2,...,n} that contain either more even than odd numbers or the same number of even and odd numbers. For example, for n=5, a(5)=15 and the 15 subsets are {2}, {4}, {1,2}, {1,4}, {2,3}, {2,4}, {2,5}, {3,4}, {4,5}, {1,2,4}, {2,3,4}, {2,4,5}, {1,2,3,4}, {1,2,4,5}, {2,3,4,5}. - Enrique Navarrete, Dec 15 2019

Examples

			a(4) = 10: 0001, 0010, 0011, 0100, 0101, 0110, 1000, 1001, 1010, 1100.
		

Crossrefs

Column k=2 of A226874.
Cf. A027306.

Programs

  • Maple
    a:= proc(n) option remember;
          `if`(n<4, n*(n-1)*(4-n)/2, (9*(n-1)*(n-4) *a(n-1)
          +(12-32*n+6*n^2) *a(n-2) -36*(n-2)*(n-4) *a(n-3)
          +8*(n-3)*(3*n-10) *a(n-4))/ (n*(3*n-13)))
        end:
    seq(a(n), n=0..40);
  • Mathematica
    Table[Sum[Binomial[n, i], {i, Floor[n/2]}], {n, 0, 30}] (* Wesley Ivan Hurt, Mar 14 2015 *)
  • PARI
    a(n) = sum(i=1, n\2, binomial(n,i)); \\ Michel Marcus, Jul 15 2022

Formula

G.f.: (3*x-1)/(2*(x-1)*(2*x-1)) + 1/(2*sqrt((1+2*x)*(1-2*x))).
a(n) = Sum_{i=1..floor(n/2)} binomial(n,i). - Wesley Ivan Hurt, Mar 14 2015
a(n) = A027306(n)-1 = 2^(n-1)-1+((1+(-1)^n)/4)*binomial(n,n/2). - Alois P. Heinz, Dec 15 2019