Related to [this question](https://mathoverflow.net/questions/390480/discrete-logarithm-and-the-sequence-an-gn-bmod-pp-1-bmod-p2).

Let $p$ be prime and $n$ positive integer.

Define $a(n)=(2^n \bmod p)^{p-1} \bmod p^2$

Let $D(n)$ be the base $2$ discrete logarithm of $a(n)$, i.e.
given $p,a(n)$ we have $2^{D(n)} \bmod p^2=a(n)$.
We can efficiently compute $D(n)=k(p-1)$ via p-adic logarithms
and code is given in the linked question.

Let $D(n)$ be computed via p-adic algorithms, probably differing
from the smallest logarithm by a small factor.

Strong numerical evidence suggests that three consecutive $D(i)$
satisfy:

$$ (D(n+2)-(D(n+3)+1)) (D(n+1)-(D(n+2)+1))(a_1 D(n+1) + a_2 D(n+2)+a_3 D(n+3)+a_4)\equiv 0 \pmod p \qquad (1)$$

for constants $a_i$.  The constants $a_i$ depend on $p$ only and 
are determined by the first few values of $D(i)$ for which the other
factors don't vanish. We don't know closed form for $a_i$.

The numerical evidence is 50 primes greater than $10^6$
and $10^3$ triples per each prime. Also several primes greater
than $10^{50}$ were successfully tested.

>Q1 Is the above identity true?

Remarks:  Let $A=2^n \bmod p$. Then $a(n)=A^{p-1} \bmod p^2$
and $a(n+1)=(2A \bmod p)^{p-1} \bmod p^2$

Finding $n$ given $a(n)$ will break the discrete logarithm,
which would be major result.