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.

A338838 Triangle read by rows: T(n,k) is the number of permutations of k elements from [1..n] where adjacent values cannot be consecutive modulo n.

This page as a plain text file.
%I A338838 #24 Dec 23 2020 08:45:03
%S A338838 1,1,1,1,2,0,1,3,0,0,1,4,4,0,0,1,5,10,10,10,10,1,6,18,36,60,84,60,1,7,
%T A338838 28,84,210,434,630,462,1,8,40,160,544,1552,3440,5168,3920,1,9,54,270,
%U A338838 1170,4338,13158,30366,47178,36954,1,10,70,420,2220,10220,39780,125220,298060,476220,382740
%N A338838 Triangle read by rows: T(n,k) is the number of permutations of k elements from [1..n] where adjacent values cannot be consecutive modulo n.
%C A338838 In a convex n-gon, the number of paths using k-1 diagonals and k non-repeated vertices.
%F A338838 T(n,k) = n*(A338526(n-1,k-1)-S(n-1,k-1)) for k>0 except T(2,2)=0, T(n,0)=1, where S(n,k) = 2*A338526(n-1,k-1)-S(n-1,k-1) for k>0, S(n,0)=0.
%e A338838 n\k  0    1    2    3    4    5    6    7    8
%e A338838 0    1
%e A338838 1    1    1
%e A338838 2    1    2    0
%e A338838 3    1    3    0    0
%e A338838 4    1    4    4    0    0
%e A338838 5    1    5    10   10   10   10
%e A338838 6    1    6    18   36   60   84   60
%e A338838 7    1    7    28   84   210  434  630  462
%e A338838 8    1    8    40   160  544  1552 3440 5168 3920
%o A338838 (PARI) isokd(d, n) = my(x=abs(d)); (x==1) || (x==(n-1));
%o A338838 isok(s, p, n) = {my(w = vector(#s, k, s[p[k]])); for (i=1, #s-1, if (isokd(w[i+1] - w[i], n) == 1, return (0))); return (1);}
%o A338838 T(n, k) = {my(nb = 0); forsubset([n, k], s, for(i=1, k!, if (isok(s, numtoperm(k, i), n), nb++););); nb;} \\ _Michel Marcus_, Nov 21 2020
%Y A338838 Right diagonal is A002493.
%Y A338838 Cf. A011973, A034807, A338526, A338849, A000166.
%K A338838 nonn,tabl
%O A338838 0,5
%A A338838 _Xiangyu Chen_, Nov 11 2020