[Tutor] Help

bob gailer bgailer at gmail.com
Wed Jul 14 03:58:01 CEST 2010


On 7/13/2010 5:50 AM, Dipo Elegbede wrote:
> I was trying to write a code that prints prime numbers between 1 and 20.

Other suggestions
  - you need only test divisors up to the square root of the candidate.
- you can easily eliminate all even numbers and numbers divisible by 3.

for i in range(0,7,3):
   isPrime(i-1)
   isPrime(i+1)

-- 
Bob Gailer
919-636-4239
Chapel Hill NC



More information about the Tutor mailing list