Practical Numbers by

def isdivisorsum(k, n):
\x09i=k
\x09while i>1:
\x09\x09if n%i<1:
\x09\x09\x09k-=i
\x09\x09i-=1
\x09return k<2

for n in range(1,501):
\x09if all(isdivisorsum(k,n) for k in range(1,n)):
\x09\x09print n

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page