Is $f(n) = \sum_{k=0}^n a^k$ bijective in $\mathbb{Z}_m$? How can I find the values of $a$ for which the following function $f:\{0,1,\dots,m-1\} \rightarrow \mathbb{Z}_m$ is bijective for a fixed $m$?
 $$f(n) = \sum_{k=0}^n a^k$$
 A: Not a full answer, but some data: it's always bijective for $a=1$. For some composite moduli, there are arithmetic progressions of $a$ for which it's bijective. For example, when $m=9$, it's bijective for $a=1,4,7$.
In general, there exist moduli $m$ and divisors $d$ of $m$ for which it's bijective precisely when $a\equiv 1\pmod d$. The list for $m\le100$ is:


*

*$m=8$, $d=4$

*$m=9$, $d=3$

*$m=16$, $d=4$

*$m=18$, $d=6$

*$m=24$, $d=12$

*$m=25$, $d=5$

*$m=27$, $d=3$

*$m=32$, $d=4$

*$m=36$, $d=12$

*$m=40$, $d=20$

*$m=45$, $d=15$

*$m=48$, $d=12$

*$m=49$, $d=7$

*$m=50$, $d=10$

*$m=54$, $d=6$

*$m=56$, $d=28$

*$m=63$, $d=21$

*$m=64$, $d=4$

*$m=72$, $d=12$

*$m=75$, $d=15$

*$m=80$, $d=20$

*$m=81$, $d=3$

*$m=88$, $d=44$

*$m=90$, $d=30$

*$m=96$, $d=12$

*$m=98$, $d=14$

*$m=99$, $d=33$

*$m=100$, $d=20$


Observations: the moduli $m$ are precisely the integers whose greatest square factor exceeds $4$. The divisors $d$ always have all prime factors of the corresponding $m$; in fact, $d$ is the largest squarefree divisor of $m$ when $m$ isn't a multiple of $4$, and twice the largest squarefree divisor of $m$ when $m$ is a multiple of $4$.
A: $f$ works as a linear congruential generator for which $c = 1$, as:
$$f(n+1) \equiv \sum_{k=0}^{n+1} a^k \equiv a \left(\sum_{k=0}^n a^k\right) + 1 \equiv a f(n) + 1 \ (\textrm{mod}\ m)$$
If the equivalent LCG has a full period, then $f$ is bijective. If $f$ is bijective, $f(k) \ne 0 \ \ \forall k < m-1$ (if $f(k) = 0$, $f(k+1) = 1 = f(0)$ and $f$ is not bijective), thus $f(m-1) = 0$ and the next value for the LCG will be equal to the seed $1$, so the LCG has a full period for any possible seed.
Therefore $f$ is bijective if and only if:


*

*$a-1$ is multiple of every prime dividing $m$.

*$m$ is not multiple of $4$ or $a-1$ is multiple of $4$.

