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

hide comments
codephilic: 2021-02-12 05:30:52

@kalai7m we had to print 1st prime then 101 th primes then 201th primes
Hint:Store all primes in vector/array then print 1 , 101 ..... primes
Hope this will help someone !

Last edit: 2021-02-12 05:31:35
mayank1987: 2021-02-05 07:33:23

i m getting tle even i used sieve help

atul0740: 2021-02-03 13:20:58

use printf instead of cout and \n istead of endl , tle will get removed

rrdesh_07: 2021-01-26 12:48:29

my solution got tle ,even though it executed perfectly on local compiler
my solution id:- 27341107

aditya04848spo: 2021-01-19 06:54:13

Use bool array in c/c++, other languages forget about it, use c++ instead, like what i did.

ratnesh123: 2021-01-08 08:20:37

i am getting TLE in python,can anyone help

akash2297: 2021-01-02 07:46:01

AC on first submit using only normal sieve!!!

ramsaicrony: 2020-12-16 12:04:27

can anyone help me....my code is giving output for 10^7 but it is giving segmentation fault for 10^8
i used bitwise sieve...

iqbal_mahmud: 2020-12-09 05:46:18

1st mod 100 after mean the loop start 0 and then increment 0+100

smap: 2020-10-07 09:52:11

You have to print n_th prime number if (n%100 == 1) .
You have to print the prime number itself. Don't print the prime number modulo 100.


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