TDPRIMES - Printing some primes

The problem statement is really simple. You are to write all primes less than 10^8

Input

There is no input.

Output

To make the problem less output related write out only the 1st, 101st, 201st, ... 1st mod 100.

Example

Input:

Output:
2
547
1229
...
99995257
99996931
99998953

Added by:Alfonso² Peterssen
Date:2010-04-06
Time limit:1.325s
Source limit:10000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM32 ASM64 BF CLPS LISP sbcl LISP clisp ERL HASK ICON ICK JS-RHINO LUA NEM NICE OBJC OCAML PHP PIKE PRLG-swi SCALA SCM guile SCM qobi ST SQLITE TCL WHITESPACE
Resource:Thanks to TDuke

hide comments
2015-06-20 10:32:44 [Mayank Pratap]
Optimised sieve AC in one go.... :
2015-04-18 15:49:21 krish
optimised seive:)
2015-02-17 14:18:16 himanshujaju
sieve of eratosthenes gives AC in 0.93s (with printf)

Last edit: 2015-02-17 14:18:38
2015-02-11 13:44:59 Madhav
good question!!
runtime on ideone but AC on spoj..
Thanks _maverick for your comment
2014-12-17 06:51:56 Dhawal Harkawat
sieve -> AC in 9.36,, Phew!
2014-12-09 18:36:08 Pawankumar P
@ALL people who solved it in under 4 seconds. How?! A hint at least!
My implementation of sieve (using only 1 or 5 mod 6 numbers) as a bool array takes 9.xx seconds and bitwise sieve of integers takes 7.xx seconds. How to optimize further?

Update: 6.62 s after using Atkin. :/

Last edit: 2014-12-09 20:08:13
2014-11-02 12:20:16 Infinity
We can easily bring this under 1 sec, just lil coding needed.i wish the timelimit was under 2 seconds. Would have been much more fun.lazy i m .
2014-09-01 21:09:37 arun vinud
optimized sieve+putchar_unlocked()->AC :)
2014-06-28 09:41:06 [Lakshman]
@surayans tiwari IDEONE is using **CUBE** cluster and here SPOJ is using Pyramid cluster...CUBE id 20X faster than Pyramid.
http://www.spoj.com/clusters
2014-06-28 08:19:59 surayans tiwari(http://bit.ly/1EPzcpv)
running in 1.7 seconds on ideone and tle here please check my code
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.