Open RobinHankin opened 5 years ago
but including this in the tests would require the partitions package to be added to the Depends list
Observing here that we are using partitions::plainperms()
; also there is no need to coerce to cycle form:
apply(plainperms(5),2,function(x){is.even(as.word(x))})
Knuth points out that the plain permutation algorithm produces alternating odd and even permutations and verifying this has nice R idiom: