Problem I
Prime Powers
Your friend Christian has been mentoring a group of high school students exploring the fascinating world of mathematics—particularly powers and exponents. As part of their studies, the students began experimenting with how numbers behave when raised to different powers, discovering many interesting patterns along the way.
To challenge them further, Christian posed a problem involving powers and products of numbers. He would like your help in writing a program to compute the correct answer so he can verify whether the students’ solutions are correct.
Given an integer $E$ and a range $[L, R]$ ($L \le R$), compute the product of the $E^{\text{th}}$ powers of all prime numbers between $L$ and $R$, inclusive.
Formally, compute:
\[ \prod _{\substack {p\ \text{prime} \\ L \le p \le R}} p^E \pmod{10^9 + 7}. \]Input
Three integers, each on a separate line:
-
$E$ ($1 \le E \le 1{,}000{,}000$)
-
$L$ and $R$ ($1 \le L \le R \le 1{,}000{,}000$)
Output
Print a single integer — the product of the $E^{\text{th}}$ powers of all primes between $L$ and $R$, modulo $10^9 + 7 = 1{,}000{,}000{,}007$.
| Sample Input 1 | Sample Output 1 |
|---|---|
3 6 10 |
343 |
| Sample Input 2 | Sample Output 2 |
|---|---|
5 20 30 |
789363995 |
