0
How do you run the sieve of sundaram algorithm
2 ответов
+ 2
Line 14:
for (x = 1; ; x++) {
This loop has no end contiditon. You are using break statements inside the loop.
I think you should check every condition which leads to a break statement.
The loop in line 30 is also critical.
The end condition of this loop is p < primes.size()
But inside the loop you are adding values to primes. Means, primes.size() gets larger -> infity loop