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.

A226197 Numbers of vectors with 2*n integers such that each element is either 1 or -1, and their sum > n.

Original entry on oeis.org

1, 1, 7, 9, 56, 79, 470, 697, 4048, 6196, 35443, 55455, 313912, 499178, 2804012, 4514873, 25211936, 40999516, 227881004, 373585604, 2068564064, 3414035527, 18844224462, 31278197839, 172186125456, 287191809724, 1577401391626, 2642070371194, 14483100716176, 24347999094724
Offset: 1

Views

Author

Alex Ratushnyak, May 31 2013

Keywords

Examples

			With n=3 there are 7 vectors with sum bigger than 3:
{1, 1, 1, 1, 1, 1}
{-1, 1, 1, 1, 1, 1}
{1, -1, 1, 1, 1, 1}
{1, 1, -1, 1, 1, 1}
{1, 1, 1, -1, 1, 1}
{1, 1, 1, 1, -1, 1}
{1, 1, 1, 1, 1, -1}
So a(3) = 7.
		

Programs

  • C
    #include 
    long long count, n;
    void addOne(long long sum, long long added) {
      if (added==n*2) {
        if (sum>n) ++count;
        return;
      }
      ++added;
      addOne(sum+1, added);
      addOne(sum-1, added);
    }
    int main() {
      for (n=1; n<99; n++) {
        count = 0;
        addOne(0, 0);
        printf("%llu, ", count);
      }
      return 0;
    }
  • Maple
    A226197 := proc(n)
        add( A094527(n,k),k=1+floor(n/2)..n) ;
    end proc: # R. J. Mathar, Jun 04 2013
  • Mathematica
    a[n_] := Sum[(2*n)!/((n-k)!*(n+k)!), {k, 1 + Floor[n/2], n}]; Array[a,30] (* Giovanni Resta, May 31 2013 *)

Formula

a(n) = sum_{k = 1+floor(n/2)...n} binomial(2n,n-k), sum of the n/2 rightmost elements of row n of A094527. - Giovanni Resta, May 31 2013