Login
Forgot Password?

OR

Login with Google Login with Twitter Login with Facebook
  • Join
  • Profiles
  • Groups
  • SuicideGirls
  • Photos
  • Videos
  • Shop
Vital Stats

magni

Member Since 2004

Followers 126 Following 194

  • Everything
  • Photos
  • Video
  • Blogs
  • Groups
  • From Others

Sunday Apr 02, 2006

Apr 2, 2006
0
  • Facebook
  • Tweet
  • Email
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.

bok bok bok bok bok bok bok bok bok bok bok bok bok bok bok bok bok bok bok bok bok bok bok

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.
olsen:
biggrin

I actually was worried that K might genuinely be hurt/upset. But I couldn't lie when she asked directly, so....crisis averted?
Apr 2, 2006

More Blogs

  • 06.27.09
    6

    Saturday Jun 27, 2009

    I haven't posted in 6 months, lol. I'm posting now but only becaus…
  • 01.07.09
    1

    Wednesday Jan 07, 2009

    Time for an update lest I forget my waning days of youthness: I am…
  • 12.03.08
    2

    Wednesday Dec 03, 2008

    PROLOGUE: Yesterday I was trying to remember what I did for Hallowe…
  • 09.14.08
    3

    Sunday Sep 14, 2008

    RIP David Foster Wallace February 21, 1962 - September 12, 2008
  • 08.23.08
    1

    Saturday Aug 23, 2008

    This is what I call striking out four weekends in a row. This Satu…
  • 07.26.08
    5

    Saturday Jul 26, 2008

    I'm off to face the black widows, brown bears, cougars, rattlesnakes,…
  • 07.16.08
    2

    Wednesday Jul 16, 2008

    Is there anything left to contribute to this raucous world? All the s…
  • 05.05.08
    3

    Monday May 05, 2008

    The quick brown meth jumped over the lazy smack.
  • 04.27.08
    2

    Sunday Apr 27, 2008

    I sometimes suddenly feel everything all at once. It feels great..…
  • 03.03.08
    15

    Monday Mar 03, 2008

    Read More

We at SuicideGirls have been celebrating alternative pin-up girls for:

23
years
10
months
19
days
  • 5,509,826 fans
  • 41,393 fans
  • 10,327,617 followers
  • 4,599 SuicideGirls
  • 1,114,448 followers
  • 14,944,928 photos
  • 321,315 followers
  • 61,453,983 comments
  • Join
  • Profiles
  • Groups
  • Photos
  • Videos
  • Shop
  • Help
  • About
  • Press
  • LIVE

Legal/Tos | DMCA | Privacy Policy | 18 U.S.C. 2257 Record-Keeping Requirements Compliance Statement | Contact Us | Vendo Payment Support
©SuicideGirls 2001-2025

Press enter to search
Fast Hi-res

Click here to join & see it all...

Crop your photo