(n: int, memo: Dict[int, Polynomial])
return memo[n]
A helper for the dp-style evaluation
    of the cycle index.

    The recurrence is given in:
    https://en.wikipedia.org/wiki/Cycle_index#Symmetric_group_Sn
A helper for the dp-style evaluation
    of the cycle index.
A helper for the dp - style evaluation of the cycle index .
def cycle_index_sym_helper(n: int, memo: Dict[int, Polynomial]) -> Polynomial:
    """
    A helper for the dp-style evaluation
    of the cycle index.

    The recurrence is given in:
    https://en.wikipedia.org/wiki/Cycle_index#Symmetric_group_Sn

    """
    if n in memo:
        return memo[n]
    ans = Polynomial([Monomial({}, Fraction(0, 1))])
    for t in range(1, n+1):
        ans = ans.__add__(Polynomial([Monomial({t: 1}, Fraction(1, 1))]) * cycle_index_sym_helper(n-t, memo))
    ans *= Fraction(1, n)
    memo[n] = ans
    return memo[n]
def cycle_index_sym_helper ( n : int , memo : Dict [ int , Polynomial ] ) -> Polynomial : if n in memo : return memo [ n ] ans = Polynomial ( [ Monomial ( { } , Fraction ( 0 , 1 ) ) ] ) for t in range ( 1 , n + 1 ) : ans = ans . __add__ ( Polynomial ( [ Monomial ( { t : 1 } , Fraction ( 1 , 1 ) ) ] ) * cycle_index_sym_helper ( n - t , memo ) ) ans *= Fraction ( 1 , n ) memo [ n ] = ans return memo [ n ]