report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Sieve of Eratosthenes - MarisaOJ: Marisa Online Judge

Sieve of Eratosthenes

Time limit: 1000 ms
Memory limit: 256 MB
Given an integer $n$. Find all primes that smaller or equal to $n$. ### Input - The first line contains an integer $n$. ### Output - Print all primes that smaller or equal to $n$ in ascending order. ### Constraints - $1 \le n \le 2 \times 10^6$. ### Example Input: ``` 15 ``` Output: ``` 2 3 5 7 11 13 ```
Basic number theory
Prime number 2
Sieve of Eratosthenes
Segmented sieve
Prime factors
Maximum GCD
Divisors counting
Largest common divisor
Nearest Element
Divisors counting 2
GCD and LCM
GGCD
Square root sum
Square number
Sum sum sum
Topic
Math
Rating 800
Solution (1) Solution