OFFSET
2,1
COMMENTS
The first number in a row, T(n,n-1)=2, corresponding to the permutations having the numbers in order and reverse order.
LINKS
Norman Whitehead, Log10 Graph of Several Rows
EXAMPLE
Triangle begins:
n: row n
---------------
2: 2;
3: 2, 4;
4: 2, 4, 12, 4, 2;
5: 2, 4, 14, 32, 18, 28, 14, 8;
6: 2, 4, 16, 36, 92, 68, 128, 92, 122, 72, 64, 16, 8;
7: 2, 4, 18, 40, 112, 240, 256, 448, 438, 668, 502, 696, 480, 496, 264, 240, 88, 48;
...
First item in each row corresponds to sum at n-1, second item to sum at n, etc.
Row 4:
|1, 2, 3, 4|=3, |1, 3, 2, 4|=5, |3, 1, 2, 4|=5, |1, 4, 2, 3|=6,
|4, 3, 2, 1|=3, |1, 3, 4, 2|=5, |3, 2, 1, 4|=5, |2, 3, 1, 4|=6,
|1, 2, 4, 3|=4, |1, 4, 3, 2|=5, |3, 4, 1, 2|=5, |3, 2, 4, 1|=6,
|2, 1, 3, 4|=4, |2, 1, 4, 3|=5, |4, 1, 2, 3|=5, |4, 1, 3, 2|=6,
|3, 4, 2, 1|=4, |2, 3, 4, 1|=5, |4, 2, 1, 3|=5, |2, 4, 1, 3|=7,
|4, 3, 1, 2|=4, |2, 4, 3, 1|=5, |4, 2, 3, 1|=5, |3, 1, 4, 2|=7,
Thus, for example, T(4,5)=12 because there are 12 permutations with a sum of differences equal to 5.
PROG
(Python)
from itertools import permutations
def count_l1_sums(n):
nm1 = n-1
a000982 = (((nm1*nm1)+1)//2) # from OEIS
tally = a000982*[0] # number of different totals
perms = permutations([i for i in range(n)]) # length is factorial(n)
# Compute each permutation's first difference
for perm in perms:
l1_norm = 0
for i in range(nm1):
diff = perm[i+1]-perm[i]
if diff>0: l1_norm += diff
else: l1_norm -= diff
tally[l1_norm-nm1] += 1 # diff==(n-1) goes into first position
return tally
CROSSREFS
KEYWORD
nonn,tabf
AUTHOR
Norman Whitehead, Mar 01 2025
STATUS
approved
