Sharedsupport / 2018-10-30-permutations.ipynbOpen in CoCalc
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."

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
%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
%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