OFFSET
0,3
LINKS
Seiichi Manyama, Table of n, a(n) for n = 0..400
FORMULA
a(n) = n * (n+1)!/3 * Sum_{k=0..n} (-1)^k/k!.
a(n) = n * (n+1) * (a(n-1)/(n-1) + (-1)^n/3) for n > 1.
a(n) = 2 * A000313(n+2). - Alois P. Heinz, Jun 22 2018
E.g.f.: exp(-x)*x^2*(3 - 2*x + x^2)/(3*(1 - x)^3). - Ilya Gutkovskiy, Jun 25 2018
EXAMPLE
n | 1 2 3 4 | the displacement of all letters | a(n)
--+---------+---------------------------------+------
2 | 2 1 | 1 + 1 = 2 | 2
3 | 2 3 1 | 1 + 1 + 2 = 4 | 8
| 3 1 2 | 2 + 1 + 1 = 4 |
4 | 2 1 4 3 | 1 + 1 + 1 + 1 = 4 | 60
| 2 3 4 1 | 1 + 1 + 1 + 3 = 6 |
| 2 4 1 3 | 1 + 2 + 2 + 1 = 6 |
| 3 1 4 2 | 2 + 1 + 1 + 2 = 6 |
| 3 4 1 2 | 2 + 2 + 2 + 2 = 8 |
| 3 4 2 1 | 2 + 2 + 1 + 3 = 8 |
| 4 1 2 3 | 3 + 1 + 1 + 1 = 6 |
| 4 3 1 2 | 3 + 1 + 2 + 2 = 8 |
| 4 3 2 1 | 3 + 1 + 1 + 3 = 8 |
PROG
(PARI) {a(n) = n*(n+1)!/3*sum(k=0, n, (-1)^k/k!)}
CROSSREFS
KEYWORD
nonn
AUTHOR
Seiichi Manyama, Jun 22 2018
STATUS
approved