cp's OEIS Frontend

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.

A162982 Triangle read by rows: T(n,k) is the number of permutations of {1,2,...,n} having k 3-term arithmetic progressions (n>=0; 0<=k<=floor((n-1)^2/4)).

This page as a plain text file.
%I A162982 #23 Nov 02 2021 21:26:47
%S A162982 1,1,2,4,2,10,12,2,20,48,46,4,2,48,156,318,152,40,4,2,104,460,1112,
%T A162982 1690,1152,406,92,18,4,2,282,1248,4058,8784,11648,8856,3906,1188,244,
%U A162982 80,20,4,2,496,2924,11360,31776,64020,86676,80700,52800,22212,6948,2158,516,214,52,22,4,2
%N A162982 Triangle read by rows: T(n,k) is the number of permutations of {1,2,...,n} having k 3-term arithmetic progressions (n>=0; 0<=k<=floor((n-1)^2/4)).
%C A162982 Row n contains 1+floor((n-1)^2/4) entries.
%C A162982 Sum of entries in row n = n! = A000142(n).
%C A162982 T(n,0) = A003407(n).
%C A162982 The terms of the sequence have been determined by direct counting (using Maple).
%C A162982 The Maple program yields the generating polynomial of the specified row n.
%H A162982 Alois P. Heinz, <a href="/A162982/b162982.txt">Rows n = 0..20, flattened</a>
%e A162982 T(5,3) = 4 because we have 12354 (containing 123, 234, 135), 21345 (containing 234, 345, and 135), and their reversals 45321 and 54312.
%e A162982 Triangle starts:
%e A162982    1;
%e A162982    1;
%e A162982    2;
%e A162982    4,   2;
%e A162982   10,  12,   2;
%e A162982   20,  48,  46,   4,  2;
%e A162982   48, 156, 318, 152, 40, 4, 2;
%e A162982   ...
%p A162982 n := 7: with(combinat): P := permute(n): st := proc (p) local ct, i, j, k: ct := 0: for i to nops(p)-2 do for j from i+1 to nops(p)-1 do for k from j+1 to nops(p) do if p[i]+p[k] = 2*p[j] then ct := ct+1 else end if end do end do end do; ct end proc: sort(add(t^st(P[i]), i = 1 .. factorial(n))); # yields the generating polynomial of row n
%t A162982 row[n_] := CoefficientList[P = Permutations[Range[n]]; st[p_List] := Module[{ct = 0, i, j, k}, For[i = 1, i <= Length[p]-2, i++, For[j = i+1, j <= Length[p]-1, j++, For[k = j+1, k <= Length[p], k++, If[p[[i]] + p[[k]] == 2*p[[j]], ct = ct+1]]]]; ct]; Sum[t^st[P[[i]]], {i, 1, n!}], t];
%t A162982 Table[ro = row[n]; Print[ro]; ro, {n, 0, 9}] // Flatten (* _Jean-François Alcover_, Sep 08 2017, adapted from Maple *)
%Y A162982 Cf. A000142, A003407, A295390.
%K A162982 nonn,tabf
%O A162982 0,3
%A A162982 _Emeric Deutsch_, Aug 31 2009