Can anyone write a nested loop that uses only the conditions of the loop and one line of code within each loop (okay maybe two in the outer loop, one for iteration one for reassignment) that uses the Sieve of Eratosthenes to calculate the highest prime number less than x and stop there?
No arrays and no excessive flags. Just loop conditions.
umm unna quit trying soon. um too dumm.
Edit: finally did it. I'm such a sloth brain. I need to get back in to practice using my noggin.
let x be the highest number
let y be the square root of x as an integer (rounded down)
let z be an iterating divisor
Do While z > 1
z = y
Do While x Mod z > 0 And z > 1
z = z - 1
Loop
x = x - 1
Loop
the resulting x will be the highest prime number.
No arrays and no excessive flags. Just loop conditions.
umm unna quit trying soon. um too dumm.























Edit: finally did it. I'm such a sloth brain. I need to get back in to practice using my noggin.
let x be the highest number
let y be the square root of x as an integer (rounded down)
let z be an iterating divisor
Do While z > 1
z = y
Do While x Mod z > 0 And z > 1
z = z - 1
Loop
x = x - 1
Loop
the resulting x will be the highest prime number.
I actually was worried that K might genuinely be hurt/upset. But I couldn't lie when she asked directly, so....crisis averted?