login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A338526 Triangle read by rows: T(n,k) is the number of permutations of k elements from [1..n] without consecutive adjacent values. 5

%I #22 Nov 17 2020 11:05:43

%S 1,1,1,1,2,0,1,3,2,0,1,4,6,4,2,1,5,12,18,20,14,1,6,20,48,90,124,90,1,

%T 7,30,100,272,582,860,646,1,8,42,180,650,1928,4386,6748,5242,1,9,56,

%U 294,1332,5110,15912,37566,59612,47622,1,10,72,448,2450,11604,46250,148648,360642,586540,479306

%N Triangle read by rows: T(n,k) is the number of permutations of k elements from [1..n] without consecutive adjacent values.

%e n\k 0 1 2 3 4 5 6 7 8

%e 0 1

%e 1 1 1

%e 2 1 2 0

%e 3 1 3 2 0

%e 4 1 4 6 4 2

%e 5 1 5 12 18 20 14

%e 6 1 6 20 48 90 124 90

%e 7 1 7 30 100 272 582 860 646

%e 8 1 8 42 180 650 1928 4386 6748 5242

%o (PARI) isok(s, p) = {for (i=1, #s-1, if (abs(s[p[i+1]] - s[p[i]]) == 1, return (0));); return (1);}

%o T(n, k) = {my(nb = 0); forsubset([n, k], s, for(i=1, k!, if (isok(s, numtoperm(k, i)), nb++););); nb;} \\ _Michel Marcus_, Nov 17 2020

%Y Diagonal is A002464.

%K nonn,tabl

%O 0,5

%A _Xiangyu Chen_, Nov 07 2020

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified July 29 14:21 EDT 2024. Contains 374734 sequences. (Running on oeis4.)