<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent changes to 8: prime.Divisors(n)</title><link href="https://sourceforge.net/p/nzmath/user-request/8/" rel="alternate"/><link href="https://sourceforge.net/p/nzmath/user-request/8/feed.atom" rel="self"/><id>https://sourceforge.net/p/nzmath/user-request/8/</id><updated>2012-01-31T07:00:24Z</updated><subtitle>Recent changes to 8: prime.Divisors(n)</subtitle><entry><title>prime.Divisors(n)</title><link href="https://sourceforge.net/p/nzmath/user-request/8/" rel="alternate"/><published>2012-01-31T07:00:24Z</published><updated>2012-01-31T07:00:24Z</updated><author><name>Philippe Guglielmetti</name><uri>https://sourceforge.net/u/drgoulu/</uri></author><id>https://sourceforge.net93ba49b73971cdd201335241dede96bc12132bfd</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I propose to split the prime.properDivisors function in order to add a fast (no sort) Divisors function:&lt;/p&gt;
&lt;p&gt;def Divisors(n):&lt;br /&gt;
"""&lt;br /&gt;
Return all divisors of n (including 1 and n).&lt;br /&gt;
"""&lt;br /&gt;
if n in (2, 3, 5, 7, 11, 13, 17, 19, 23):&lt;br /&gt;
return []&lt;br /&gt;
else:&lt;br /&gt;
l = [1]&lt;br /&gt;
for p, e in _factor(n):&lt;br /&gt;
for j in range(1, e + 1):&lt;br /&gt;
l += [k*pow(p, j) for k in l if k % p != 0]&lt;/p&gt;
&lt;p&gt;def properDivisors(n):&lt;br /&gt;
"""&lt;br /&gt;
Return proper divisors of n (divisors of n excluding 1 and n).&lt;/p&gt;
&lt;p&gt;It is only useful for a product of small primes.&lt;br /&gt;
One can use FactoredInteger.proper_divisors() as well.&lt;br /&gt;
"""&lt;br /&gt;
l=Divisors(n)&lt;br /&gt;
l.remove(1)&lt;br /&gt;
if n!=1:l.remove(n)  # prevents properDivisors(1) from crashing&lt;br /&gt;
l.sort()&lt;br /&gt;
return l&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>