Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

First 100 Prime Nos.

Name: C++ 2009-08-10 6:32

I'm trying to make a program which displays the first 100 prime numbers. I've managed to make one which tells us whether a number is prime or not(http://pastebin.com/m38992e3e), but I cannot figure out how to print the first 100 prime nos.

Any help?

Name: Anonymous 2009-08-10 6:43

take 10 $ sieve [2..]
  where sieve (n:ns) = n : sieve [k | k <- ns, mod k n /= 0]

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List