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

superprimes Batch , stdin/stdout

Registered Users Only

Please login to utilize this feature.

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

superprimes.html

Problem Description

As mentioned in a similar problem, Bradley loves primes! However, there is something he loves more. Superprimes!

What are superprimes? Basically, superprimes are primes in prime positions. In other words, let's take the first five primes [2, 3, 5, 7, 11] as an example. Superprimes are primes in position which are primes, so basically the superprimes are the 2nd, 3rd and 5th primes. (since 2 3 5 are primes), which are 3, 5 and 11. Thus, the first 3 superprimes are 3, 5 and 11.

Given an integer N, help Bradley find out the Nth superprime.

Input

The input will contain one integer, N.

Output

Your output should contain one integer, the Nth superprime.
Your output should be terminated by a newline.

Limits

Subtask 1 (10%): 1 ≤ N ≤ 100
Subtask 2 (20%): 1 ≤ N ≤ 1 000
Subtask 3 (30%): 1 ≤ N ≤ 10 000
Subtask 4 (40%): 1 ≤ N ≤ 100 000
Subtask 5 (0%): As per sample testcases
It is guranteed that the output will not exceed 30 000 000.

Sample Input 1

3

Sample Output 1

11

Sample Input 2

5

Sample Output 2

31

Tags

Number Theory

Subtasks and Limits

Subtask Score #TC Time Memory Scoring
110104s128MBMinimum
220104s128MBMinimum
330104s128MBMinimum
440104s128MBMinimum
5024s128MBMinimum

Judge Compile Command

g++-8 ans.cpp -o superprimes -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.