oj mrJudge
Toggle navigation
  • Login
    • Forget Password
      Login
User Image

Hello, Stranger

Guest
  • Analysis Mode
  • Problems
    • All Problems
    • Latest Problems
  • Join Us Now
  • Registration
  • Contact Us
  • Infomation
  • About
    • Terms of Use
    • Technical Specifications
    • Credits

moreprimes Batch , stdin/stdout

Registered Users Only

Please login to utilize this feature.

Do note that this website only supports submissions in C++.

moreprimes.html

Problem Description

Jacob is not happy with the small primes he has seen so far, so he has decided to generate some larger primes of his own! Given two integers P and Q, help Jacob find all the primes from P to Q inclusive.

Limits

Subtask 1 (38%): P = 1, 1 ≤ Q ≤ 104.

Subtask 2 (22%): P = 1, 1 ≤ Q ≤ 106.

Subtask 3 (40%): 1 ≤ P ≤ Q ≤ 1013, Q - P ≤ 107.

Subtask 4 (0%): Sample Testcases.

Input

The only line of input will contain two integers, P and Q.

Output

The output should contain all primes from P to Q, listed in ascending order, one on each line.

Sample Testcase 1

Input

1 20

Output

2
3
5
7
11
13
17
19

Sample Testcase 2

Input

70 80

Output

71
73
79

Tags

Math

Subtasks and Limits

Subtask Score #TC Time Memory Scoring
138211s256MBMinimum
222411s256MBMinimum
340621s256MBMinimum
4021s256MBMinimum

Judge Compile Command

g++-8 ans.cpp -o moreprimes -Wall -Wshadow -static -O2 -lm -m64 -s -w -std=gnu++17 -fmax-errors=512

Accepted Submissions

subIDUserTimeMax Time

Past Submissions

subIDUserTimeScore
mrJudge 09.05.20
Copyright © 2020 mrJudge. All rights reserved.