I decided on something like this:

-----

cimport sage.rings.integer

primessq = [4, 9, 25, 49, 121, 169, 289, 361, 529, 841, 961, 1369,
1681, 1849,
            2209, 2809, 3481, 3721, 4489, 5041, 5329, 6241, 6889,
7921, 9409]
len_primes = 25

def int_has_small_square_divisor(sage.rings.integer.Integer d):
    cdef int i, asq = 1

    for i from 0 <= i < len_primes:
        while mpz_divisible_ui_p(d.value, primessq[i]):
            asq *= primessq[i]
            mpz_divexact_ui(d.value, d.value, primessq[i])
    return asq

-----

Comments?

JV


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to