# Fifth power remainders

For any prime $$p>7,$$ consider the remainders when the fifth powers (i.e. $$n^5$$) are divided by $$p$$. Let $$f(p)$$ be the smallest possible remainder which is not 0 or 1.

The sum of the two smallest possible ratios $$\frac{p}{f(p)}$$ can be written as $$\frac{a}{b}$$, where $$a$$ and $$b$$ are coprime positive integers. What are the last three digits of the value of $$a+b$$?

Details and assumptions

As an explicit example, for $$p=13$$, you can verify that the possible remainders are $$0, 1, 2, \ldots, 12$$. Thus $$f(13) = 2$$.

×