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.
%I A357329 #38 Jul 05 2024 08:20:23 %S A357329 1,1,1,1,2,3,1,3,7,9,1,4,12,24,35,1,5,18,46,93,137,1,6,25,76,187,366, %T A357329 591,1,7,33,115,327,765,1523,2553,1,8,42,164,524,1400,3226,6436,11323, %U A357329 1,9,52,224,790,2350,6072,13768,27821,50461,1,10,63,296,1138,3708,10538,26480,59673,121626,226787 %N A357329 Triangular array read by rows: T(n, k) = number of occurrences of 2k as a sum |1 - p(1)| + |2 - p(2)| + ... + |n - p(n)|, where (p(1), p(2), ..., p(n)) ranges through the permutations of (1,2,...,n), for n >= 1, 0 <= k <= n-1. %C A357329 In the Name, (1,2,...,n) can be replaced by any of its permutations. The first 10 row sums are the first 10 terms of A263898. %H A357329 Alois P. Heinz, <a href="/A357329/b357329.txt">Rows n = 1..141, flattened</a> %e A357329 First 8 rows: %e A357329 1 %e A357329 1 1 %e A357329 1 2 3 %e A357329 1 3 7 9 %e A357329 1 4 12 24 35 %e A357329 1 5 18 46 93 137 %e A357329 1 6 25 76 187 366 591 %e A357329 1 7 33 115 327 765 1523 2553 %e A357329 For n=3, write %e A357329 123 123 123 123 123 123 %e A357329 123 132 213 231 312 312 %e A357329 000 011 110 112 211 211, %e A357329 where row 3 represents |1 - p(1)| + |2 - p(2)| + |3 - p(n)| for the 6 permutations (p(1), p(2), p(2)) in row 3. The sums in row 3 are 0,2,2,4,4,4, so that the numbers 0, 2, 4 occur with multiplicities 1, 2, 3, as in row 3 of the array. %p A357329 g:= proc(h, n) local i, j; j:= irem(h, 2, 'i'); %p A357329 1-`if`(h=n, 0, (i+1)*z*t^(i+j)/g(h+1, n)) %p A357329 end: %p A357329 T:= n-> (p-> seq(coeff(p, t, k), k=0..n-1)) %p A357329 (coeff(series(1/g(0, n), z, n+1), z, n)): %p A357329 seq(T(n), n=1..12); # _Alois P. Heinz_, Oct 02 2022 %t A357329 p[n_] := p[n] = Permutations[Range[n]]; %t A357329 f[n_, k_] := f[n, k] = Abs[p[n][[k]] - Range[n]] %t A357329 c[n_, k_] := c[n, k] = Total[f[n, k]] %t A357329 t[n_] := Table[c[n, k], {k, 1, n!}] %t A357329 u = Table[Count[t[n], 2 m], {n, 1, 10}, {m, 0, n - 1}] (* A357329, array *) %t A357329 Flatten[u] (* A357329, sequence *) %Y A357329 Cf. A000142, A263898. %Y A357329 Subtriangle of A062869. %Y A357329 T(2n,n) gives A072948 (for n>0). %K A357329 nonn,tabl %O A357329 1,5 %A A357329 _Clark Kimberling_, Sep 24 2022