Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

Testing latest pari + WASM + node.js... and it works?! Wow.

28493 views
License: GPL3
ubuntu2004
Function: permcycles
Section: combinatorics
C-Name: permcycles
Prototype: G
Help: permcycles(x): cycles of the permutation x.
Doc: given a permutation $x$ on $n$ elements, return the orbits of
 $\{1,\ldots,n\}$ under the action of $x$ as cycles.
 \bprog
 ? permcycles(Vecsmall([1,2,3]))
 %1 = [Vecsmall([1]),Vecsmall([2]),Vecsmall([3])]
 ? permcycles(Vecsmall([2,3,1]))
 %2 = [Vecsmall([1,2,3])]
 ? permcycles(Vecsmall([2,1,3]))
 %3 = [Vecsmall([1,2]),Vecsmall([3])]
 @eprog