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
Abel Nieto Rodriguez: 2010-06-04 14:46:14

@Alfonso2
viejo, aqui estoy fajado con tu problema "forro"!!! :-)

sudipto das: 2010-05-21 11:22:27

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 :(

numerix: 2011-02-08 12:46:28

Could you please open it for Python.
Edit: Thanks for adding more languages.

Last edit: 2010-04-17 07:19:39
jean caffou: 2010-04-17 07:05:32

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
numerix: 2010-04-17 07:05:32

There's nothing strange about that. SPOJ uses very slow machines.

jean caffou: 2010-04-17 07:05:32

My program also executes in 5secs, but I get TLE on SPOJ (time limit here is 10s) strange..

pankaj: 2010-04-17 07:05:32

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
pankaj: 2010-04-17 07:05:32

my program giving output in 2.99 sec in my sys :( TLE here

hosam samy: 2010-04-17 07:05:32

the program takes 4 or 5 seconds in my PC and i got TLE :|


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