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.

A250283 Number of permutations p of [n] such that p(i) > p(i+1) iff i == 0 (mod 6).

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 6, 27, 83, 209, 461, 923, 10284, 80991, 414961, 1671853, 5699149, 17116009, 278723178, 3135810159, 22493048843, 124606826189, 574688719793, 2301250545971, 49308397822776, 721175428306971, 6650954153090521, 46893517738791361
Offset: 0

Views

Author

Alois P. Heinz, Nov 16 2014

Keywords

Examples

			a(6) = 1: 123456.
a(7) = 6: 1234576, 1234675, 1235674, 1245673, 1345672, 2345671.
		

Crossrefs

Row n=6 of A181937.

Programs

  • Maple
    b:= proc(u, o, t) option remember; `if`(u+o=0, 1,
         `if`(t=0, add(b(u-j, o+j-1, irem(t+1, 6)), j=1..u),
                   add(b(u+j-1, o-j, irem(t+1, 6)), j=1..o)))
        end:
    a:= n-> b(n, 0$2):
    seq(a(n), n=0..35);
  • Mathematica
    nmax = 30; CoefficientList[Series[1 + Sum[(x^(6 - k) * HypergeometricPFQ[{1}, {7/6 - k/6, 4/3 - k/6, 3/2 - k/6, 5/3 - k/6, 11/6 - k/6, 2 - k/6}, -x^6/46656])/(6 - k)!, {k, 0, 5}] / HypergeometricPFQ[{}, {1/6, 1/3, 1/2, 2/3, 5/6}, -x^6/46656], {x, 0, nmax}], x] * Range[0, nmax]! (* Vaclav Kotesovec, Apr 21 2021 *)
  • Sage
    # From Peter Luschny, Feb 06 2017 (Start)
    @cached_function
    def b(u, o, t):
        if u ==-o: return 1
        if t == 0: return sum(b(u-j, o+j-1, (t+1) % 6) for j in (1..u))
        return sum(b(u+j-1, o-j, (t+1) % 6) for j in (1..o))
    a = lambda n: b(n, 0, 0)
    print([a(n) for n in (0..28)]) # after Maple program
    # Alternatively:
    @cached_function
    def A(m, n):
        if n == 0: return 1
        s = -1 if m.divides(n) else 1
        t = [m*k for k in (0..(n-1)//m)]
        return s*add(binomial(n, k)*A(m, k) for k in t)
    A250283 = lambda n: (-1)^int(is_odd(n//6))*A(6, n)
    print([A250283(n) for n in (0..28)])
    # (End)