16
2
For the purpose of this challenge, a Prime Power of a Prime (PPP) is defined as a number that can be defined as a prime number to the power of a prime number. For example, 9 is a PPP because it can be represented as 3^2. 81 on the other hand is not a PPP because it can only be represented as 3^4, and 4 is not prime. The first few PPPs are: 4, 8, 9, 25, 27, 32, 49, 121, 125, 128, 169, 243, 289, 343... This is OEIS sequence A053810
Your Task:
Write a program or function that for an input integer n returns/outputs the nth PPP, either 1-indexed or 0-indexed, whichever you prefer.
Input:
An integer between 0 and 1,000, received through any reasonable method.
Output:
The PPP at the index indicated by the input.
Test Cases:
These are 1-indexed, and so, if your program takes 0-indexed input, the same output should be arrived at for the stated input - 1.
3 -> 9
6 -> 32
9 -> 125
Scoring:
This code-golf,lowest score in bytes wins!
This challenge was sandboxed
– Gryphon – 2017-10-07T12:27:44.913