<s>[INST] Find p is the prime number which $\frac{p+1}{2}$ and $\frac{p^2+1}{2}$ both are square number. Find p is the prime number which $\dfrac{p+1}{2}$ and $\dfrac{p^2+1}{2}$ both are square number.
I do not know how to use "p is prime" assumption given. I just know
$p=7$ is satisfied.
If $\dfrac{p+1}{2}=X^2$ and $\dfrac{p^2+1}{2}=Y^2$ then $(X^2;X^2-1;Y)$ is Pythagorean triple
 [/INST] \begin{align}
  & p=2{x}^{2}-1 \\ 
 & {{p}^{2}}=2{{y}^{2}}-1 \\ 
 & \Rightarrow {{p}^{2}}-p=2{{y}^{2}}-2{{x}^{2}} \\ 
 & \Rightarrow  p(p-1)=2(y-x)(y+x)  
\end{align}
Wlog, assume $x,y$ are positive and it is easy to see $p>2$.
Then, from $(4)$, we have $y> x$ and: 
a) $p|y-x$ and $2(y+x)|p-1$ 
we get $p\leq y-x$ and $y+x\leq {p-1\over 2}$ so $p\leq {p-1\over 2}$ and no solution.
b)  $p|y+x$ and $2(y-x)|p-1$ 
we get $p\leq y+x$ and $y-x\leq {p-1\over 2}$ so $p\leq 4x-1$. 
But $p={2x^2-1}$, so we have ${2x^2-1}\leq 4x-1$ and thus $\boxed{x\leq 2}$.
</s>