[seqfan] Permutations with even sums of adjacent triples
Richard J. Mathar
mathar at mpia-hd.mpg.de
Sun Dec 17 23:15:41 CET 2017
Les Reid asks in http://people.missouristate.edu/lesreid/POW12_1011.html:
how many permutations of [n] exist such that the sum of 3 adjacent
numbers is always even? This seems to start
6,4,24,0,144,0,0,0 (n>=3)
computed with a naive Maple program:
is3ev := proc(L)
for s from 1 to nops(L)-2 do
if type(op(s,L)+op(s+1,L)+op(s+2,L),'odd') then
return false;
end if;
end do:
true ;
end proc:
P3ev := proc(n)
a := 0 ;
if n >= 3 then
for p in combinat[permute](n) do
if is3ev(p) then
a := a+1 ;
end if;
end do:
end if:
a ;
end proc:
Example: a(n=3)=6 because for all 6 permutations the sums are 6.
a(n=4)=4 counts [2, 1, 3, 4], [2, 3, 1, 4], [4, 1, 3, 2], and [4, 3, 1, 2].
Someone with a good feeling of recursive enumeration might extend
and submit this.....
RJM
More information about the SeqFan
mailing list