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

  • 11.05.07
    9

    Monday Nov 05, 2007

    Read More
  • 09.12.07
    16

    Wednesday Sep 12, 2007

    Read More
  • 09.03.07
    6

    Monday Sep 03, 2007

    Time flies when you should be getting stuff done.
  • 09.02.07
    4

    Sunday Sep 02, 2007

    I hate everyone today. I wish it was trendier to hate people these …
  • 08.13.07
    6

    Monday Aug 13, 2007

    I live an unexciting life. Sure I get a little drunked, but I don't d…
  • 07.14.07
    33

    Saturday Jul 14, 2007

    EDIT: Drunken ramblings
  • 07.06.07
    9

    Friday Jul 06, 2007

    Right now I don't really know what to say.
  • 06.06.07
    11

    Wednesday Jun 06, 2007

    Read More
  • 05.31.07
    0

    Thursday May 31, 2007

    Woah! Score 1 for the darkside!
  • 05.26.07
    1

    Saturday May 26, 2007

    Read More

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

23
years
10
months
27
days
  • 5,509,826 fans
  • 41,393 fans
  • 10,327,617 followers
  • 4,600 SuicideGirls
  • 1,115,138 followers
  • 14,950,629 photos
  • 321,315 followers
  • 61,468,875 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