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
sgc_072: 2017-10-03 20:37:26

Segmented sieve it is!! Also learnt about memset(a, b, c) function.

Last edit: 2017-10-03 20:38:18
dunjen_master: 2017-08-31 16:11:30

0.22 sec AC in one go

ilovegianghsgs: 2017-08-05 05:10:38

AC in 0.24s using bitwise sieve, in 0.46s with classic sieve using bitset

pratham_1: 2017-07-16 13:51:25

SPOJ hates java so much :((

Haha done beautiful problem btw:)))

Last edit: 2017-07-16 15:00:47
rohit9934: 2017-06-19 09:14:46

From TLE to 0.23 sec.

elegantalgo: 2017-04-30 21:19:32

AC in 0.66 seconds.
Here's the catch -- I did it in Python 3 ;)

coder_hsnake: 2017-02-01 00:12:49

use bitwise sieve

dwij28: 2016-10-15 23:14:16

There is a first time for everything. Like getting a SIGXFSZ error for not reading the question properly and printing all the primes. :D Use bitset in C++.. AC 0.68 seconds :)

akshayvenkat: 2016-07-05 17:36:19

what? same exact code gave TLE yesterday and AC today :O

Shidhu : 2016-03-25 20:54:26

i have took 0.79 !
it was my first problem solved with sieve :)


Added by:Alfonso2 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 clisp LISP sbcl 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