login
A317329
Number of permutations of [n] with equal lengths of increasing runs.
3
1, 2, 2, 7, 2, 82, 2, 1456, 1515, 50774, 2, 3052874, 2, 199364414, 136835794, 19451901825, 2, 2510158074714, 2, 370671075758054, 132705620239756, 69348874393843334, 2, 15772160279898993782, 613498040952503, 4087072509293134292962, 705927677748508225534
OFFSET
1,2
LINKS
FORMULA
a(n) = 2 <=> n in { A000040 }.
EXAMPLE
a(4) = 7: 1234, 1324, 1423, 2314, 2413, 3412, 4321.
MAPLE
b:= proc(u, o, t, d) option remember; `if`(u+o=0, 1,
`if`(t=d, add(b(u-j, o+j-1, 1, d), j=1..u),
add(b(u+j-1, o-j, t+1, d), j=1..o)))
end:
a:= proc(n) option remember; `if`(n=1, 1, 2+add(
b(n, 0, d$2), d=numtheory[divisors](n) minus {1, n}))
end:
seq(a(n), n=1..35);
MATHEMATICA
b[u_, o_, t_, d_] := b[u, o, t, d] = If[u + o == 0, 1,
If[t == d, Sum[b[u - j, o + j - 1, 1, d], {j, 1, u}],
Sum[b[u + j - 1, o - j, t + 1, d], {j, 1, o}]]];
a[n_] := a[n] = If[n == 1, 1, 2 + Sum[b[n, 0, d, d], {d, Divisors[n] ~Complement~ {1, n}}]];
Array[a, 35] (* Jean-François Alcover, Aug 01 2021, after Alois P. Heinz *)
CROSSREFS
Column k=1 of A317327.
Sequence in context: A211780 A014840 A218756 * A235709 A341760 A342453
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Jul 25 2018
STATUS
approved