login
A097278
Triangle read by rows: T(n, k) = number of permutations <p(1), p(2), ..., p(n)> of <1, 2, ..., n> that end with k, such that p(k) > p(k-1) when k is composite and p(k) < p(k-1) when k is prime. (n > 0, 1 <= k <= n).
1
1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 3, 3, 2, 1, 0, 0, 3, 6, 8, 9, 9, 35, 35, 32, 26, 18, 9, 0, 0, 35, 70, 102, 128, 146, 155, 155, 0, 0, 35, 105, 207, 335, 481, 636, 791, 0, 0, 0, 35, 140, 347, 682, 1163, 1799, 2590, 6756, 6756, 6756, 6756, 6721, 6581, 6234, 5552, 4389, 2590, 0
OFFSET
1,11
FORMULA
T(1, 1) = 1, T(n, k) = sum(i = k..(n-1), T(n-1, i)) if n is prime, T(n, k) = sum(i = 1..(k-1), T(n-1, i)) if n is composite.
EXAMPLE
T(5, 2) = 3: the 3 permutations are <4,3,1,5,2>, <5,3,1,4,2> and <5,4,1,3,2>.
CROSSREFS
Cf. A097277.
Sequence in context: A016037 A106449 A256522 * A254411 A056223 A261143
KEYWORD
easy,nonn,tabl,less
AUTHOR
David Wasserman, Aug 05 2004
STATUS
approved