Hi all, I wanted to implement the Euler Transformation. https://oeis.org/wiki/Euler_transform My first attempt was:
def EulerTransform(size, a): R.<x> = ZZ[[]] f = prod((1 - x^n)^a(n) for n in (1..size)) + O(x^size) return f.inverse().list() print(EulerTransform(6, lambda n: factorial(n))) Now try this with size = 30. I have no idea how long this takes because after 3 years I turned the computer off. Am I doing something fundamentally wrong, or is f.inverse() hopelessly slow? You can of course implement it differently, but that's not my question. For those who are interested in the transformation here the fast variant: def EulerTrans(a): @cached_function def b(n): if n == 0: return 1 s = sum(sum(d*a(d) for d in divisors(j))*b(n-j) for j in (1..n)) return s//n return b b = EulerTrans(lambda n: factorial(n)) print([b(n) for n in range(30)]) Thanks -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/6b781cb6-9366-41b8-9bf2-2640f1a8cc9co%40googlegroups.com.