## For an odd prime $p$, define $f(p) = \left\lfloor\frac{2^{(2^p)}}{p}\right\rfloor\bmod{2^p}$

For example, when $p=3$, $\lfloor 2^8/3\rfloor = 85 \equiv 5 \pmod 8$ and so $f(3) = 5$.

Further define $g(p) = f(p)\bmod p$. You are given $g(31) = 17$.

Now define $G(N)$ to be the summation of $g(p)$ for all odd primes less than $N$.

You are given $G(100) = 474$ and $G(10^4) = 2819236$.

Find $G(10^7)$.

### This problem seems to be more of a puzzle or a contest problem rather than a typical math problem you’d encounter in a textbook or a course. It’s not something that would typically fall under immediately demonstrable theorems or formulas, and would require a creativity, understanding of number theory, and potentially some programming skills as well.

However, here’s an approach that might give you the answer:

We start by noticing that, for the majority of cases, $f(p)$ actually simplifies to 2, and this can be proven considering Euler’s Theorem, modular arithmetic, and how exponentiation works in modular arithmetic. Euler’s Totient Theorem, which is a generalization of Fermat’s Little Theorem, states that

$a^{\phi(n)} \equiv 1 \pmod{n}$

for any integer ‘a’ relatively prime to ‘n’. Here ‘\phi(n)’ refers to Euler’s totient function, which yields the count of integers that are relatively prime to ‘n’ and lie between 1 and ‘n’. For a prime number ‘p’, ‘\phi(p)’ is ‘p-1’.

Now, because 2 is relatively prime to any odd prime ‘p’, we can use Euler’s theorem here. Let us write down $f(p)$ expression and use Euler’ theorem on it

$f(p) \equiv 2^{(2^p)} \pmod {p}$

Applying Euler’s theorem here

$f(p) \equiv 2^{(2^p) \mod {\phi(p)}} \pmod {p}$

Since p is prime, $\phi(p) = p – 1 = 2^{p-1} * 2 – 2$

$f(p) \equiv 2^{(2^p) \mod {2^{p-1} * 2}} \pmod {p}$

Here, $2^p$ is larger than $2^{p-1} * 2$ for all primes greater than 2. Applying modulo operation gives:

$f(p) \equiv 2^{2^{p-1} * 2} \pmod {p}$

Simplify it more as

$f(p) \equiv 2^{2} \pmod {p}$

Hence, for all primes ‘p’ greater than 2,

$f(p) = 4 \pmod p$

Also for p = 2 itself, $2^{2^{2}} / 2 = 2^{2} = 4$, so

$f(2) = 4 \pmod 2$

Hence, $f(p) = 4 \pmod p$ for all p >= 2

Therefore, $g(p) = f(p) \bmod p$, means $g(p) = 4 \bmod p$

So, $g(2) = 0$ and $g(p) = 4$ for all other primes.

So the sum of $g(p)$ for all odd primes less than $N$ amounts to counting the number of odd primes less than $N$ and multiplying that count by 4, as each such prime contributes 4 to the sum.

To find $G(10^7)$, which is the sum of $g(p)$ for all primes less than 10 million, you’d need to count the primes less than 10 million, subtract one to get rid of the prime ‘2’ which contributed ‘0’, and multiply the resulting count by 4. The counting of primes is a task for which you would typically use a “Sieve of Eratosthenes” or similar algorithm, potentially needing a computer program due to the large number.

Please note that this approach is based on understanding of number theory and modular arithmetic. If you require further details in any step, feel free to ask.

##### More Answers:

Exponent DifferenceTurán’s Water Heating System

Sextuplet Norms