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

hide comments
zeeshanhaider: 2025-02-17 14:50:06

Basic save code:
<snip>
[Simes]: no thanks.

Last edit: 2025-02-17 19:53:04
sotezkhanhero: 2024-12-27 09:36:15

I didn't store prime number in bool array why?

flareon: 2024-10-21 12:13:29

<snip>
This code works fine. solved Using simple sieve
[Simes]: good for you.

Last edit: 2024-10-22 15:05:51
kakshiii1999: 2024-06-18 19:28:01

Getting TLE with simple sieve,also used bool array

ashish1_1: 2023-12-27 14:52:19

is solution available on the website?

Simes: 2023-06-02 08:50:13

@naim19149 @mr_variable: Take the index of a prime, mod it by 100 and if the result is 1, print it.

naim19149: 2023-05-31 19:57:42

what does this "1st mod 100." mean in the question?

mr_variable: 2023-05-09 08:12:36

what does this "1st mod 100." mean in the question?

hharshit_8118: 2023-01-09 17:48:54

read carefully how to output answer

amansh2: 2022-09-28 21:36:00

use boolean vector or array


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