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.

A282516 Number T(n,k) of k-element subsets of [n] having a prime element sum; triangle T(n,k), n>=0, 0<=k<=n, read by rows.

Original entry on oeis.org

0, 0, 0, 0, 1, 1, 0, 2, 2, 0, 0, 2, 4, 1, 0, 0, 3, 5, 2, 2, 0, 0, 3, 7, 6, 4, 2, 0, 0, 4, 9, 10, 11, 7, 1, 0, 0, 4, 11, 18, 21, 13, 7, 2, 0, 0, 4, 14, 26, 34, 31, 20, 7, 3, 0, 0, 4, 18, 37, 53, 59, 51, 32, 11, 2, 0, 0, 5, 21, 47, 82, 110, 117, 85, 35, 12, 2, 0
Offset: 0

Views

Author

Alois P. Heinz, Feb 17 2017

Keywords

Examples

			Triangle T(n,k) begins:
  0;
  0, 0;
  0, 1,  1;
  0, 2,  2,  0;
  0, 2,  4,  1,  0;
  0, 3,  5,  2,  2,   0;
  0, 3,  7,  6,  4,   2,   0;
  0, 4,  9, 10, 11,   7,   1,  0;
  0, 4, 11, 18, 21,  13,   7,  2,  0;
  0, 4, 14, 26, 34,  31,  20,  7,  3,  0;
  0, 4, 18, 37, 53,  59,  51, 32, 11,  2, 0;
  0, 5, 21, 47, 82, 110, 117, 85, 35, 12, 2, 0;
  ...
		

Crossrefs

Row sums give A127542.
Main diagonal gives A185012.
First lower diagonal gives A282518.
T(2n,n) gives A282517.

Programs

  • Maple
    b:= proc(n, s) option remember; expand(`if`(n=0,
          `if`(isprime(s), 1, 0), b(n-1, s)+x*b(n-1, s+n)))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=0..n))(b(n, 0)):
    seq(T(n), n=0..16);
  • Mathematica
    b[n_, s_] := b[n, s] = Expand[If[n==0, If[PrimeQ[s], 1, 0], b[n-1, s] + x*b[n-1, s+n]]];
    T[n_] := Function[p, Table[Coefficient[p, x, i], {i, 0, n}]][b[n, 0]];
    Table[T[n], {n, 0, 16}] // Flatten (* Jean-François Alcover, Mar 21 2017, translated from Maple *)