OFFSET
0,2
COMMENTS
EXAMPLE
For n = 2, the second differences of the (2+1)! = 6 permutations of {0,1,2} are:
[0,1,2] -> [1, 1] -> 0,
[0,2,1] -> [2,-1] -> -3,
[1,0,2] -> [-1, 2] -> 3,
[1,2,0] -> [1,-2] -> -3,
[2,0,1] -> [-2, 1] -> 3, and
[2,1,0] -> [-1,-1] -> 0.
The sum of the absolute values of these second differences is 0 + 3 + 3 + 3 + 3 + 0 = 12.
MATHEMATICA
a[n_] := Block[{x, k}, k = CoefficientList[(x - 1)^n, x]; Sum[Abs[k.p], {p, Permutations@ Range[0, n]}]]; Array[a, 10, 0] (* Giovanni Resta, Nov 23 2019 *)
PROG
(Python)
from math import comb
from itertools import permutations
def A329851(n):
c = [-comb(n, i) if i&1 else comb(n, i) for i in range(n+1)]
return sum(abs(sum(c[i]*p[i] for i in range(n+1))) for p in permutations(range(n+1)) if p[0]<p[-1])<<1 # Chai Wah Wu, Jun 04 2024
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Peter Kagey, Nov 22 2019
EXTENSIONS
a(10) from Alois P. Heinz, Nov 22 2019
a(11)-a(13) from Giovanni Resta, Nov 23 2019
STATUS
approved