in reply to Easy way to list prime numbers 1 to 100
You might want to check the definition of a prime number. After running your code, @primes includes a lot of numbers that aren't prime (9, 15 and 21 for example). In fact you seem to be calculating all of the odd numbers rather than the prime numbers.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Answer: Easy way to list prime numbers 1 to 100
by blazar (Canon) on May 22, 2006 at 11:01 UTC | |
by BrowserUk (Patriarch) on May 22, 2006 at 21:22 UTC | |
by gellyfish (Monsignor) on May 23, 2006 at 09:42 UTC | |
by BrowserUk (Patriarch) on May 23, 2006 at 10:00 UTC | |
by gellyfish (Monsignor) on May 23, 2006 at 10:25 UTC |