>>> p = 2**4 * 3**4 * 5**3
>>> a = [[k**x for x in range(0,v + 1,2)] for k,v in factorint(p).items() 
if v >= 2]
>>> sorted([Mul(*x) for x in product(*a)])
[1, 4, 9, 16, 25, 36, 81, 100, 144, 225, 324, 400, 900, 1296, 2025, 3600, 
8100, 32400]


On Thursday, September 12, 2013 4:42:47 PM UTC+2, Stephen Loo wrote:
>
> Hi all,
>
> How do you get all perfect squares that are divisor of integer x?
>
> Thanks,
> Stephen
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to