Arithmetic sequence modulo a prime number I am not a mathematician or a math student, but an electrical engineer. I have noticed that an arithmetic sequence modulo a prime number p contains every integer between zero and that prime number if the arithmetic sequence has at least p elements and the arithmetic sequence has a common difference less than p.
A couple questions:

*

*Does this have a name?


*What reference would help me understand this, or can you help me understand this?
An example in Python is shown below.
import numpy as np

# https://stackoverflow.com/questions/2068372/fastest-way-to-list-all-primes-below-n?page=1&tab=scoredesc#tab-top
def primes(n):
    """ Returns  a list of primes < n """
    sieve = [True] * n
    for i in range(3,int(n**0.5)+1,2):
        if sieve[i]:
            sieve[i*i::2*i]=[False]*((n-i*i-1)//(2*i)+1)
    return [2] + [i for i in range(3,n,2) if sieve[i]]

# Common differences for arithmetic sequences
d_list = np.arange(2,20)
# Prime numbers
p_list = primes(50)
for p in p_list:
    # Common difference must be less than prime number
    sub_d = d_list[d_list < p]
    for d in sub_d:
        all_ints = set(np.arange(p))
        seq = np.arange(0, d*p, d)
        mod_set = set(seq % p)
        if not mod_set == all_ints:
            print(f'Broken at {d},{p}!')

Thank you
 A: This is a result of elementary number theory. We can restate it as the combination of the following results:
Prop 1$\,\,\,\,$Let $p$ be a prime and $a$ an integer not divisible by $p$. Then as $k$ ranges from $0$ to $p-1$, $ak$ also takes on all values from $0$ to $p-1$, modulo $p$.
Another, more concise, way to say this is that multiplication by $a$ induces a bijection from $\mathbb Z/p$ to itself. (Here $\mathbb Z/p = \{0, 1, \ldots, p-1\}$ is the set of residues of the integers modulo $p$.) For a proof of this fact, consult any book on elementary number theory, for instance Elementary Number Theory by Rosen.
Prop 2$\,\,\,\,$Let $n$ be any positive integer, and $b$ any integer. Then as $k$ ranges from $0$ to $n-1$, $b+k$ also takes on all values from $0$ to $n-1$, modulo $n$.
This is easier to see. First, reduce $b$ modulo $p$ if necessary so that $0 \leq b < p$. Then, allowing $k$ to vary, the numbers $b+k$, modulo $n$, take on the values
$$
b, b+1, b+2, \ldots, n-1, 0, 1, \ldots, b-1
$$
Combining these results, we get your observation: If $p$ is a prime, $a, b$ are integers with $p$ not dividing $a$, and $k$ varies from $0$ to $p-1$, then $ak + b$ also takes on all values from $0$ to $p-1$, modulo $p$. Obviously if $k$ is allowed to continue past $p-1$, then $ak+b$ will begin to repeat values modulo $p$.
