TDPRIMES - Printing some primes

The problem statement is really simple. You are to write all primes less than 108.

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
2010-10-03 11:54:13 !!!!!
lolzzz!!! in ma system it's giving ans in 2.4s and tle here..
2010-07-16 16:26:56 Vimal poonia
my accepted program on 7.6 going tle nw
i think spoj machines are not belivable !!
2010-06-04 14:46:14 Abel Nieto Rodriguez
@Alfonso2
viejo, aqui estoy fajado con tu problema "forro"!!! :-)
2010-05-21 11:22:27 sudipto das
Modular arithmatics can help to make Sieve of Eratosthenes more fast & get AC from TLE............
2010-04-17 07:05:32 যোবায়ের
Damn! I didn't know that unsigned is slow :(
2011-02-08 12:46:28 numerix
Could you please open it for Python.
Edit: Thanks for adding more languages.

Last edit: 2010-04-17 07:19:39
2010-04-17 07:05:32 jean caffou
I am testing on a very limited virtual machine...

EDIT: It really does make a lot of difference if your program is running at the same time as someone else's :)

Also uint_32 is slow, you don't have to keep a temp table of N, and #define-d functions are much faster than normal functions...

Last edit: 2010-04-12 15:49:34
2010-04-17 07:05:32 numerix
There's nothing strange about that. SPOJ uses very slow machines.
2010-04-17 07:05:32 jean caffou
My program also executes in 5secs, but I get TLE on SPOJ (time limit here is 10s) strange..
2010-04-17 07:05:32 pankaj
after lots of optimization it went to 2.8 now i don't know how to optimize more
[edit] My another code run for 2.76 in my system accepted at 9.59 here. Reduce the sizeof sieve and it will accept. Biut i really want to know how people are gotten accepted at <1sec?

Last edit: 2010-04-14 06:26:18
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.