calcPrimeNumbers(28) would output
The primes less than or equal to 28 are:
2 3 5 7 11 13 17 19 23
2,3,5,7
Vinod Kumar Nair
"Any fool can write code that a computer can understan. Good programmers write code that humans can understand."
Everyday in every way, we get a little better.
said by BobbyYou will be interested in reading through this past forum thread as well.
https://coderanch.com/t/516856/java/java/Sieve-Eratosthenes#2343984
Vinod Kumar Nair
"Any fool can write code that a computer can understan. Good programmers write code that humans can understand."
Since there was a lot more than only Sieve of Eratosthenes in that discussion (I remember it wellBobby Smallman wrote:. . . past forum thread as well. . . .
Everyday in every way, we get a little better.
The Sieve is hardly more complicated, and much more efficient; that code will run in quadratic time and looks inefficient to me.Bobby Smallman wrote:. . . A simple yet efficient way . . .
Campbell Ritchie wrote:
The Sieve is hardly more complicated, and much more efficient; that code will run in quadratic time and looks inefficient to me.Bobby Smallman wrote:. . . A simple yet efficient way . . .
I suspect the Sieve is quadratic complexity, too, but still much faster.
Everyday in every way, we get a little better.
You don't do that round our way at Teesside. Our anti-plagiarism software would find CodeRanch in a few seconds and the entire assignment would receive a mark of 0Ernest Friedman-Hill wrote:. . . handed it in for his homework assignment. . . .
Everyday in every way, we get a little better.
Bobby Smallman wrote:My bad
... Won't happen again guys!
Don't get me started about those stupid light bulbs. |