Is there an explicit formula for the number of fourth powers mod n?


Finch & Sebah [1] give theorems, partially folklore, for squares and cubes mod n, but I don't know of a similar formula for higher powers.


[1] S. R. Finch and Pascal Sebah, [Squares and Cubes Modulo n](http://arXiv.org/abs/math.NT/0604465)



Number of biquadrates mod n
As stated in the comments ([1](https://mathoverflow.net/questions/72201/number-of-biquadrates-mod-n#comment182932_72201) [2](https://mathoverflow.net/questions/72201/number-of-biquadrates-mod-n#comment182983_72201) [3](https://mathoverflow.net/questions/72201/number-of-biquadrates-mod-n#comment183408_72201)), the counting function is multiplicative, so only the prime power case needs to be addressed. Last year, I derived a somewhat concise formula for $\lvert R\_k (p^m)\rvert$, where $R\_k (p^m)$ is the set of $k$-th power residues (not necessarily coprime to the modulus) modulo $p^m$. It was recently accepted for publication: [Counting general power residues](https://doi.org/10.7546/nntdm.2022.28.4.730-743). Here is the result, quoted from the paper:



> 
> Let $\epsilon$ be the parity function. So for integers $t$, $
>  \epsilon(t) = \begin{cases}
>  0 &\text{ if } 2\mid t\\
>  1 &\text{ if } 2\nmid t. \end{cases} $
> 
> 
> Let $p$ be a prime, and $k\ge 2$ and $m\ge 1$ be integers. Let $r$ be
> the remainder of $m$ upon division by $k$. Let \begin{align\*}
>  \alpha &= \dfrac{p-1}{(k,p-1)},\\
>  \beta &= (\nu\_p (k)+1)(1-\epsilon(k))(1-\epsilon(p))+\nu\_p(k)\epsilon (p),\\
>  \gamma &=
>  \begin{cases}
>  k &\text{ if } k \mid m\\
>  r &\text{ if } k\nmid m.
>  \end{cases}. \end{align\*} Then \begin{align\*} \lvert R\_k (p^m)\rvert &= \alpha \cdot \left(\dfrac{p^k}{p^{\beta +1}}\cdot
>  \dfrac{p^m-p^{\gamma}}{p^k-1}+
>  \left\lceil\dfrac{p^{\gamma}}{p^{\beta+1}}\right\rceil\right)+1\\ &=
>  \alpha \cdot \left\lceil\dfrac{1}{p^{\beta +1}}\cdot
>  \dfrac{p^{m+k}-p^{\gamma}}{p^k-1}\right\rceil+1. \end{align\*}
> 
> 
> (Note that the $\dfrac{p^k}{p^{\beta +1}}\cdot
>  \dfrac{p^m-p^{\gamma}}{p^k-1}$ term is necessarily an integer, so it
> can be absorbed into the ceiling term
> $\left\lceil\dfrac{p^{\gamma}}{p^{\beta+1}}\right\rceil$ as shown.)
> 
> 
> 


Obviously the proof is what matters, but computational testing matched the results of the formulas in all cases tried.


**References:** My initial inspiration was a paper [Counting squares in $\mathbb Z\_n$](https://doi.org/10.1080/0025570X.1996.11996456) of Walter Stangl, who addressed the quadratic case. Also, my discussion with Arturo Magidin in [Is there a known formula for the number of $k^{\text{th}}$ power residues modulo $2^n$?](https://math.stackexchange.com/questions/3796985/is-there-a-known-formula-for-the-number-of-k-textth-power-residues-modulo) was helpful in the derivation. After submission to the first journal that I tried, a reviewer noted that similar formulas were mentioned by Maxim Korolev in [On the average number of power residues modulo a composite number](https://ui.adsabs.harvard.edu/abs/2010IzMat..74.1225K/abstract) ([DOI](https://doi.org/10.1070/IM2010v074n06ABEH002522)), who himself referred to a paper [The Number of kth Power Residues Modulo m](http://njsfdxzrb.paperonce.org/oa/darticle.aspx?type=view&id=200101001) of Ji Chungang.


**Note:** Given the content of the above references, the originality of my minor contribution rests only on unifying the various cases by noticing their similarities, summing a series that the others left unclosed, and expanded elementary exposition. I am not surprised that I was able to publish it only after trying a couple of other more well-known journals first, but it was a little surprising that the arXiv rejected posting it.


