TDPRIMES - Printing some primes


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

Input

There is not 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


hide comments
:(){ :|: & };:: 2010-04-17 07:05:32

I used Sieve of Eratosthenes with some magic ;-)

EDIT: To all who are getting TLE,try twice before going for some more modification,due to congestion in the server sometimes it gives TLE,there were few times I resubmitted the same AC solution but I got TLE.


@Ravi:

Eratosthenes is good for this task,but not for the harder version.

Last edit: 2010-04-12 15:20:43
Alfonso2 Peterssen: 2010-04-17 07:05:32

Yes, but with really hard optimizations

Ravi Kiran: 2010-04-17 07:05:32

Finally done!!phew!
Nice one!
Sieve of eratosthenes does work!!! :)

Last edit: 2010-04-11 10:40:23

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 qobi SCM guile ST SQLITE TCL WHITESPACE
Resource:Thanks to TDuke