|
COMMENT
|
If n>=5, triples may have strides larger than 1. Example for n=5: in
the permutation [1,3,5,2,4], triples [1,3,5], [3,5,2], [5,2,4] and [1,5,4]
contribute, where the latter aligns pi(1)=1, pi(3)=5 and pi(5)=4 =9 mod 5.
|
|
EXAMPLE
|
For n=4 consider the A000142(4)=24 permutations of [1,2,3,4]. From [1,2,3,4],
the triples [1,2,3] and [2,3,4] contribute to a(4). No triples from [1,2,4,3],
[1,3,2,4], [1,3,4,2] and [1,4,2,3] contribute. From [1,4,3,2] the triples
[1,4,3] (that is [1,4,7] mod 4) and [4,3,2] contribute. From [2,1,3,4], no triples
contribute. From [2,1,4,3], [2,1,4] (that is [2,1,0] mod 4) and [1,4,3] contribute,
the latter counting again although found earlier. So far we saw 6 triples
for a(4); scanning the remaining permutations increases this to a(4)=16.
|
|
MAPLE
|
a := proc(n) local a, pers, p, stri, i1, extr, tri ; a :=0 ; pers := combinat[permute](n) ; for p in pers do for stri from 1 to floor((n-1)/2) do for i1 from 1 to n-2*stri do tri := [op(i1, p), op(i1+stri, p), op(i1+2*stri, p)] ; extr := op(1, tri)+2*( op(2, tri)-op(1, tri) ) ; if extr mod n = op(3, tri) mod n then a := a+1 ; fi ; od; od; od: RETURN(a) ; end: for n from 3 do print(n, a(n)) ; od:
|