Constructing a base $b$ repunit that is $a$ $\pmod p$ Suppose I want to construct a number of the form ($b^n-1$)/($b-1$) $=$ $a$ $\pmod p$ with $n$ and $p$ prime. What are the limitations on the base $b$ $>$ $1$ and prime $n$? 
For example, if ($b^n-1$)/($b-1$) $=$ $4$ $\pmod 5$, what are possible choices for $b$ and (prime) $n$ in modular form?
I was able to find that $b$ nor prime $n$ $≠$ $2, 3, 5, 7$ or $11$. As an example that there exists such a number with $b > 1$ and $n$ prime: ($6^{19}-1$)/$5$ $=$ $4$ $\pmod 5$.
 A: I can't offer you an ultimate answer to your question, but perhaps my explanations can give you some ideas.
Since you demand $n$ to be a prime number, we have
$$\frac{b^n-1}{b-1} = 1+b+...+b^{n-1} = \Phi_n(b),$$
where $\Phi_n$ denotes the $n$-th cyclotomic polynomial.
So you might be successful in applying the theory of cyclotomic polynomials to your question. Let me mention two properties of (cyclotomic) polynomials here which could be useful:
1) If we fix $b \in \mathbb{N}$, then we know that for any polynomial $f \in \mathbb{Z}[X]$ and any $k \in \mathbb{Z}$ we have $f(b) \equiv f(b+pn)$ (mod $p$). So we may reduce your question to the case $b \in \{ 0, ..., p-1 \}$.
2) If $p$ prime does not divide $n \in \mathbb{N}$ (in your case: if $n \neq p$), then $\exists b \in \mathbb{Z} \colon \Phi_n(b) \equiv 0$ (mod $p$) $\Longleftrightarrow$ $p \equiv 1$ (mod $n$).
If $n = p$, it is easy to show that $\Phi_n(b) \equiv 0$ (mod $p$) if $b \equiv 1$ (mod $p$) and $\Phi_n(b) \equiv 1$ (mod $p$) in any other case.
What happens, if we choose $a \neq 0,1$? (Note, that we may reduce to $a \in \{ 0, ..., p-1 \}$ as well.) I don't know if there is a handy theorem which deals with that case. But in fact, it is possible to find the answer by trying out all possibilities!
We already mentioned that it suffices to take $b \in \{ 0, ..., p-1 \}$. But what can we say about $n$? Let's consider $b=1$ firstly. Then $\Phi_n(b)=n$ and it is easy to decide how many prime numbers $n$ there are such that $n \equiv a$ (mod $p$) [hint: Dirichlets prime number theorem]. But on the other hand we have the equivalence $\forall b \in \{ 0,2,...,p-1 \} \colon \frac{b^n-1}{b-1} \equiv \frac{b^m-1}{b-1}$ (mod $p$) $\Longleftrightarrow$ $n \equiv m$ (mod $p-1$). (Note the existence of a primitive root mod $p$.) In different words: If $n \equiv m$ (mod $p-1$) (and both prime), then $\Phi_n(b) \equiv \Phi_m(b)$ (mod $p$) for all $b \in \{ 0,2,...,p-1 \}$. So it is sufficient to consider one prime number of each of the forms $(p-1)z+l, z \in \mathbb{Z}, l \in \{ 0,...,p-1 \}$.
To summarize: For given $a$ and $p$, your question can be answered by a finite calculation.
Let's consider a=4, p=5 for an example. So we have $b \in \{ 0,1,2,3,4 \}$. The first question is: Are there prime numbers $n$ such that $n \equiv 4$ (mod $5$)? Yes, there are infinitely many such prime numbers according to Dirichlets prime number theorem, for instance $n = 19, 29, ...$. So the choice $b \equiv 1$ (mod $5$), $n \equiv 4$ (mod $5$) prime leads to infinitely many solutions.
In the next step, we may look for prime numbers of the forms $4z, 4z+1, 4z+2$ and $4z+3$. We find $2, 3$ and $5$ (the first type is impossible). Now we calculate:
$\Phi_2(0) \equiv 1$ (mod $5$); $\Phi_2(2) \equiv 3$ (mod $5$); $\Phi_2(3) \equiv 4$ (mod $5$); $\Phi_2(4) \equiv 0$ (mod $5$) 
$\Phi_3(0) \equiv 1$ (mod $5$); $\Phi_3(2) \equiv 2$ (mod $5$); $\Phi_3(3) \equiv 3$ (mod $5$); $\Phi_3(4) \equiv 1$ (mod $5$) 
$\Phi_5(0) \equiv \Phi_5(2) \equiv \Phi_5(3) \equiv \Phi_5(4) \equiv 1$ (mod $5$)
There is only one "4", namely in the case $n \equiv 2$ (mod $4$) prime and $b \equiv 3$ (mod $5$). $2$ is the only prime number which is $\equiv 2$ (mod $4$), so the choice $n=2$, $b \equiv 3$ (mod $5$) leads to all the other solutions.  
A: $(b^n-1) = (b-1)(b^{n-1} + b^{n-2} + ... + b^2 + b + 1)$
So (assuming $b \neq 1$!) it might be easier to directly consider 
$$(b^{n-1} + b^{n-2} + ... + b^2 + b + 1) = a \mod p$$
If $p | b$, the above is true only if $a = 1$; and in that case it is true for all $n$, prime or not. So let's assume that $p$ is not a factor of $b$. 
In the example you gave with $b=6, p=5$, we get that $b = 1 \mod p$, so your equation becomes $n = a \mod p$. 
We only care about the modulo result for $b$; i.e, if it works for some $b$, it will also work for $(b+p)$, and similarly for $n$ (assuming it's still a prime!).
So, e.g., $(11^{19}-1)/10 = 4 \mod 5$ as well - what matters is that $b = 1 \mod 5$; then every $n$ (prime or not) satisfying $n = 4 \mod 5$ also works (e.g., $(31^{24}-1)/30 = 4 \mod 5$)
What else can be said? Let's say $0 < b < p$. Then $b^{p-1}=1 \mod p$; and the terms in your sum begin repeating every $p-1$ powers. So given $b$ and $p$, let $$S_k = \sum_{i=0}^{k-1}b^i \mod p$$
(with $S_0 = 0$, the 'empty sum'). Suppose $n = d(p-1) + m$, where $0 <= m < p-1$ (so $m = n \mod (p-1)$). Then 
$$(b^{n-1} + b^{n-2} + ... + b^2 + b + 1) = S_n = d \cdot S_{p-1} + S_m \mod p$$
For $p = 5$, there are the following possibilities (in each case, $S_{p-1} = S_4$)
$$b=1 \rightarrow S_n = n $$
$$b=2 \rightarrow S_1=1, S_2= 3, S_3=2, S_4=0 $$
$$b=3 \rightarrow S_1=1, S_2= 4, S_3=3, S_4=0 $$
$$b=4 \rightarrow S_1=1, S_2= 0, S_3=1, S_4=0 $$
From this we see that for $p=5, a = 4$, the only solutions are:
$(b=1, n=4 \mod 5)$ and $(b=3, n=2 \mod 4)$. Note than when $b$ is such that $S_{p-1} = 0$, 
$$S_n = d \cdot S_{p-1} + S_m = S_m = S_{n \mod p-1}$$
so we just look for those $b$ with some $S_m = a$. Of course, the only prime $n = 2 \mod 4$ is 2! So for example $(13^2 -1)/12 = 4 \mod 5$.
So we can also find the conditions for other values of $a$ from the above; for example for $a = 3$, we have: $$(b=1, n=3 \mod 5)$$ $$(b=2, n= 2 \mod 4)$$ $$(b=3 , n = 3 \mod 4)$$ and no solutions for $b = 4$.
For larger values of prime $p$, you can use the same approach. Some observations:
If $b = 1 \mod p$, then you can always look for primes of the form $n = a \mod p$.
If $b \neq 1 \mod p$, then $S_{p-1} = 0$ (proof omitted); in which case you always get:
$$S_n = d \cdot S_{p-1} + S_m = S_m$$
so you need only look for those $b$ such that $S_m = a \mod p$, where $n = m \mod p-1$.
