I had a go at this question again but it yielded no results. None of the general number theory related theorems helped ...
I don't know if this helps at all, but apparently there is a formula due to Legendre saying that , where is the sum of the digits of n in base p.
Reference: http://www.math.tulane.edu/~vhm/web_html/k-central.pdf (pdf file).