|
Prime sum challenge
|
|
12-04-2009, 10:07 AM
(This post was last modified: 12-04-2009 10:17 AM by codecaine.)
Post: #1
|
|||
|
|||
|
Prime sum challenge
What is the sum of all prime numbers below 5000?
Answer is: 1548136 Code: #returns true if number is prime else falsenote for the isprime function all you need to do is go up to the square root of a number for the loop. I will save time for large numbers. I did not include it in this source because I didn't really need it |
|||
|
12-04-2009, 11:17 PM
Post: #2
|
|||
|
|||
|
RE: Prime sum challenge
Very good solution i must say.
I made that in Pascal too : Code: program sum_of_primes_below_5000;There's a fine line between genius and insanity. I have erased this line. Oscar Levant There's a fine line between an administrator and black hat hacker. I have erased this line. Dr DEBCOL |
|||
|
12-05-2009, 12:42 AM
Post: #3
|
|||
|
|||
|
RE: Prime sum challenge
awesome code
|
|||
|
« Next Oldest | Next Newest »
|





