def weighted_digit_sum(n): """ Return the weighted sum of binary digits of ``n`` where ``i``th digit from the right has weight ``i-1``. INPUT: - ``n`` -- integer. OUPUT: the weighted digit sum of ``n``. EXAMPLE:: sage: weighted_digit_sum(5) 2 """ return sum([i[0]*eval(i[1]) for i in enumerate(Integer(n).binary()[::-1])]) def number_of_odd_dimensional_partitions(n): """ Return the number of odd dimensional irreducible representations of the ``n``th symmetric group. INPUT: - ``n`` -- integer. OUTPUT: - number of partitions for which the associated irreducible representation of the symmetric group in ``n`` letters has even dimension. EXAMPLE:: sage: number_of_odd_dimensional_partitions(5): 4 ALGORITHM: Return ``2**weighted_digit_sum(n)``. """ return 2**weighted_digit_sum(n) def number_of_chiral_partitions(n, v=None): """ Return the number of partitions ``la`` of ``n`` for which `f_{\lambda/(1,1)}` is odd INPUT: - ``n`` -- integer. OUTPUT: The number of partitions of ``n`` for which the corresponding irreducible representation of the symmetric group has non-trivial determinat. EXAMPLE:: sage: number_of_chiral_partitions(3) 2 """ def base_case_odd(k, v = v): if k == 1: if v is None: return 2 elif v == 0: return 1 elif v == 1: return 1 else: return 0 else: if v is None: return sum([base_case_odd(k, v) for v in range(k+1)]) if v == 0: return 2^(k-1) elif v > 0 and v < k: return 2^((v+1)*k - 2*(v+1) - v*(v-1)/2) elif v == k: return 2^(k*(k-1)/2) else: return 0 def base_case_even(k, v = v): if k == 1: if v is None or v == 0: return 1 else: return 0 else: if v is None: return sum([base_case_even(k, v) for v in range(k)]) if v == 0: return 2^(k-1) elif v > 0 and v < k: return 2^((v+1)*k - 2*(v+1) - v*(v-1)/2) else: return 0 if n == 0 or n == 1: return 0 k = valuation(n, 2) if k == 0: w = valuation(n - 1, 2) m = n - (2^w + 1) return number_of_odd_dimensional_partitions(m)*base_case_odd(w, v = v) else: m = n - 2^k return number_of_odd_dimensional_partitions(m)*base_case_even(k, v = v)