Sharedsupport / 2018-10-30-permutations.ipynbOpen in CoCalc
Author: William A. Stein
License: GNU General Public License v3.0
Description: Examples for support purposes.

"Is there a permutation engine online which will tell me how many elements of order 6 are in S_7 or A_7? (and similar questions) @wolframalphacom didn't seem up to the task."

In [16]:
def elts_of_order_Sn(n, k): a = 0 for s in SymmetricGroup(n): if s.order() == k: a += 1 return a def elts_of_order_An(n, k): a = 0 for s in AlternatingGroup(n): if s.order() == k: a += 1 return a
In [17]:
%time elts_of_order_Sn(7,6)
CPU times: user 6.6 ms, sys: 3.76 ms, total: 10.4 ms Wall time: 7.48 ms
1470
In [18]:
%time elts_of_order_An(7,6)
CPU times: user 10.6 ms, sys: 7.89 ms, total: 18.5 ms Wall time: 22 ms
210
In [ ]: