I am working with so-called Ramanujan graphs which have the property that a lower bound on their girth can be stated. I am reading about those in paper On the Construction of Turbo Code Interleavers Based on Graphs with Large Girth where such graphs are used in order to construct good Turbo code interleavers.
While going through the construction of those graphs, they speak about having to solve the diophantine equation
$a^2+b^2+c^2+d^2=p \quad(in\quad \mathbb{Z})$
where $p$ is an odd prime and $a,b,c,d\in\mathbb{Z}$ are integers that fullfil
- if $p\equiv1\mod{4}$ then $a>0$ odd and $b,c,d$ are even.
- if $p\equiv 3 \mod{4}$ then $a>0$ odd; $b,c$ odd and $d$ even
It is stated that such a diophantine equation has several answers and so by using them you can construct the associated Ramanujan graph. However, as I am not an expert in diophantine equations I do not know if such an equation has to have solutions under such assumptions, and if it has, how many solutions should it have. Consequently, I am interested in knowing when does such diophantine equation have solutions, and how can I know (if possible) how many possible answers to such are possible under the conditions given by $p$.