Status: Valid
Owner: ----
Labels: Type-Enhancement Priority-Low

New issue 4019 by [email protected]: divisors could use a 'pairs' flag
http://code.google.com/p/sympy/issues/detail?id=4019

Something that might be convenient with divisors is to give it a flag that indicates that the divisors should be given in pairs:

d=divisors(4);p=[(d[i],d[len(d)-i-1]) for i in range(len(d)//2 + (len(d)%2 == 1))]
p
[(1,4),(2,2)]

d=divisors(120);p=[(d[i],d[len(d)-i-1]) for i in range(len(d)//2 + (len(d)%2 == 1))]
p
[(1,120),(2,60),(3,40),(4,30),(5,24),(6,20),(8,15),(10,12)]

I guess p could also be computed as [(d[i], n//d[i]) for i in range(len(d)//2+(len(d)%2 == 1))], e.g.

d
[1,2,3,4,5,6,8,10,12,15,20,24,30,40,60,120]

n=120
[(d[i], n//d[i]) for i in range(len(d)//2+(len(d)%2 == 1))]
[(1,120),(2,60),(3,40),(4,30),(5,24),(6,20),(8,15),(10,12)]

n=4;d=divisors(4)
[(d[i], n//d[i]) for i in range(len(d)//2+(len(d)%2 == 1))]
[(1,4),(2,2)]


--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" 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-issues.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to