How many distinct homeomorphism classes of lens spaces are there with a fixed p?

This question is about the topological classification of lens spaces. Fix $p$ a positive integer, not necessarily a prime. From Brody, The topological classification of lens spaces, Annals of Math. (2) 71 pp 163-184, the lens spaces $L(p,q_1)$ and $L(p,q_2)$ are homeomorphic if and only if either $q_1\equiv \pm q_2$ (mod $p$) or $q_1q_2\equiv \pm 1$ (mod $p$). Now the question is, for fixed $p$, how many homeomorphism classes of lens spaces are there with this fixed $p$. In particular, is there a formula $f(p)$ that gives the number of homemorphism classes as a function of $p$.

Example: When $p=7$, then $q$ can be chosen from the set $\{1,2,3,4,5,6\}$ (since any such $q$ is coprime to 7) and we find that $L(7,1)\approx L(7,6)$ (where $\approx$ denotes homeomorphism) and $L(7,2)\approx L(7,3)\approx L(7,4)\approx L(7,5)$ so that there are two distinct homeomorphism classes of lens spaces with $p=7$. Thus $f(7)=2$.

Example: When $p=8$, then $q$ can be chosen from the set $\{1,3,5,7\}$ (since $p$ and $q$ need to be coprime) and then $L(8,1)\approx L(8,7)$ and $L(8,3)\approx L(8,5)$ so in this case there are again two homeomorphism classes of lens spaces with $p=8$. Thus $f(8)=2$.

Remark: For any $p$, the permissible $q$'s can be found and then Brody's formula can be applied to each such pair of $q$'s to determine which are homeomorphic to each other. Thus $f(p)$ can be computed by hand for any $p$.

My question is, is there a formula for $f(p)$?

• This should be a straightforward computation using Burnside's lemma (you're counting orbits under the action of the finite group generated by multiplying by $\pm 1$ and taking inverses), more appropriate for math.SE than here. – Qiaochu Yuan Feb 2 '14 at 20:28
