Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The solution seems to be to shift the problem to complex numbers and then use QQbar.

def Omega(m, lng) -> list[int]:
    L = LazyLaurentSeriesRing(QQbar, 'x')
    x = L.gen()
    if m == 0: return [L(0^n) for n in (0..lng)]
    w = QQbar(exp(2 * pi * I / m))
    f = sum(exp(x * w**j) for j in range(m)) / m 
    return [round(real(factorial(n)*f.coefficient(n))) for n in (0..lng)]

for m in (0..6): print(Omega(m, 24))