On Jul 15, 1:46 pm, Santanu Sarkar <sarkar.santanu....@gmail.com> wrote: > Suppose f=2*x^2+3*x+1 is a polynomial in x. How efficiently we > can calculate f^10 modulo 24?
quite fast i think: sage: R.<x> = PolynomialRing(Integers(24), x) sage: R Univariate Polynomial Ring in x over Ring of integers modulo 24 sage: f = 2*x^2+3*x+1 sage: type(f) <type 'sage.rings.polynomial.polynomial_zmod_flint.Polynomial_zmod_flint'> sage: f^10 16*x^20 + 8*x^18 + 12*x^12 + 12*x^11 + 21*x^10 + 6*x^9 + 21*x^8 + 18*x^6 + 12*x^5 + 6*x^4 + 12*x^3 + 17*x^2 + 6*x + 1 sage: %timeit f**10 10000 loops, best of 3: 52.1 µs per loop sage: %timeit f**100 10000 loops, best of 3: 91.6 µs per loop sage: %timeit f**1000 1000 loops, best of 3: 591 µs per loop h --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---