SPRIME - Super Primes

no tags 

In mathematics, a prime number (or a prime) is a natural number which has exactly two distinct natural number divisors: 1 and itself.

Super-prime numbers are the elements of the subsequence of prime-numbers that occupy prime-numbered positions within the sequence of all prime numbers. That is, if p(i) denotes the ith prime number, the numbers in this sequence are those of the form p(p(i)) or Primes with a prime index in the sequence of prime numbers (the 2nd, 3rd, 5th, ... prime).

Your task is to generate all super primes < 10^7.

Input:

There is NO input for this problem.

Output:

Print all super-primes < 10^7 in ascending order,one per line.

First few lines of Output

3
5
11
17
31
41
59
67
83
109
...

hide comments
Omar: 2016-12-13 22:44:05

Accepted in the second time , use sieve algorithm .

Kishlay Raj: 2014-04-16 18:27:23

easy
--ans(Francky)--> Then do it in Python ;-)

Last edit: 2014-04-16 18:29:55

Added by:Swarnaprakash
Date:2008-08-05
Time limit:1s
Source limit:10000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ERL JS-RHINO NODEJS PERL6 VB.NET
Resource:Myself