code: def get_cycle_index_sym(n: int) -> Polynomial:
      """
      Compute the cycle index
      of S_n, i.e. the symmetry
      group of n symbols.
  
      """
      if n < 0:
          raise ValueError("n should be a non-negative integer.")
  
      memo = {
          0: Polynomial([Monomial({}, Fraction(1, 1))]),
          1: Polynomial([Monomial({1: 1}, Fraction(1, 1))]),
          2: Polynomial(
              [
                  Monomial({1: 2}, Fraction(1, 2)),
                  Monomial({2: 1}, Fraction(1, 2)),
              ]
          ),
          3: Polynomial(
              [
                  Monomial({1: 3}, Fraction(1, 6)),
                  Monomial({1: 1, 2: 1}, Fraction(1, 2)),
                  Monomial({3: 1}, Fraction(1, 3)),
              ]
          ),
          4: Polynomial(
              [
                  Monomial({1: 4}, Fraction(1, 24)),
                  Monomial({2: 1, 1: 2}, Fraction(1, 4)),
                  Monomial({3: 1, 1: 1}, Fraction(1, 3)),
                  Monomial({2: 2}, Fraction(1, 8)),
                  Monomial({4: 1}, Fraction(1, 4)),
              ]
          ),
      }
      result = cycle_index_sym_helper(n, memo)
      return result
  
file_path: keon-algos/algorithms/maths/symmetry_group_cycle_index.py
imports: from fractions import Fraction
  from typing import Dict, Union
  from polynomial import Monomial, Polynomial
  from gcd import lcm
label_desc: Use image node_id 4 for calling a global function with example usage: get_cycle_index_sym(n) and returns: result