print "This code is EXTREMELY inefficient. Can you do better?"
print "Email to: pi3challenge@sheffield.ac.uk"
def divisors(n):
return [i for i in range(1,n+1) if n % i == 0]
def ndiv(n):
return len(divisors(n))
nmax = 1000
divs = [ndiv(i) for i in range(1,nmax+1)]
print "Here are the number of divisors of the first " + str(nmax) + " numbers:"
print divs
primes = [i for i in range(1,nmax+1) if divs[i-1] == 2]
print "Here is a list of the first " + str(len(primes)) + " prime numbers:"
print primes