If you look at the equation $$f(p)=2^p-p^2+1$$ there are three solutions, one of them being exactly $p=3$. The other ones are irrational and can only be found using numerical methods such as Newton. These roots are $p=3.40745$ and $p=-1.19825$. The negative root can be discarded since $p=\tan^2(x)$.
To $p=3.40745$ corresponds $x=1.07432$ which is another solution very close to $x=\frac {\pi} {3}=1.04720$
Edit
It is interesting to notice that, if we develop the function as a Taylor series at $x=3$, we obtain $$f(p)= (8\log (2)-6)(p-3)+ \left(4 \log ^2(2)-1\right)(p-3)^2+O\left((p-3)^3\right)$$ which cancels at $$p=\frac{3+12 \log ^2(2)-8 \log (2)}{4 \log ^2(2)-1}\approx 3.49340$$ which is very close to the second solution. Expanding for one more order and solving the quadratic would give a solution $\approx 3.41174$.
It is also interesting to notice that the roots of the first derivatives are explicit in terms of Lambert function $$\left\{p= -\frac{W\left(-\frac{1}{2} \log ^2(2)\right)}{\log
(2)}\right\},\left\{p= -\frac{W_{-1}\left(-\frac{1}{2} \log ^2(2)\right)}{\log
(2)}\right\}$$ Developing $f(p)$ as a Taylor series to second order at the second (the largest root) allows to estimate the roots at $3.00933$ and $3.41554$.