All odd primes except $5$ divide a number made up of all $1$s Okay, so I have worked on this problem and even though I can see it is true I just don't know how to show it.
Here it goes.
Question:
Show that every odd prime except $5$ divides some number of the form $111 \ldots 11$ ($k$ digits, all ones).
Thank you my friends!
 A: Given an odd prime $p$ it is known (Fermat's Little Theorem) that $p$ divides $10^{p-1}-1$, hence, $(10^{p-1}-1)/9$ except you have to note 3 divides 111). 
A: By a simple Pigeonhole argument one can prove much more: if $\rm\:n\:$ is coprime to $10\,$ then every integer with at least $\rm\:n\:$ digits $\ne 0$  has a contiguous digit subsequence that forms an integer $\ne 0$ divisible by $\rm\:n.\:$ In your case the divisor $\rm\:n,\,$ being an odd prime $\ne 5,\,$ is coprime to $10,\,$ therefore the $\rm\,n\,$ digit number $\,111\ldots111\,$ does the trick, i.e. some subsequence $\,11\ldots11\,$ is divisible by $\rm\,n.$ 
A: It is of course okay to use Fermat's Little Theorem, but it can be done by an even more elementary argument. Saying your $p$ divides the number, say $mp$, formed with $k$ digits $1$ means that $10^k=9mp+1$, so one searches $k$ such that $10^k\equiv1\pmod{9p}$. Now $9p$ is coprime to $10$ if $p$ is, which implies that mulitplication by $10$ is an invertible operation on integers modulo $9p$ (you can find a multiplicative inverse of $10$ using Euclid's algorithm, but its existence is all that matters). Now imagine writing the powers $10^0=1,10^1,10^2,\ldots$ reduced modulo $9p$ until the first time some number (more precisely some class modulo $9p$) already present re-appears. If that number were not $1$, then inverting the multiplication by $10$ on the two equal numbers immediately gives a contradiction, so it is in fact the number has to be $1$. This gives your $k$.
So you don't have to use the catch-all exponent $\phi(9p)$ (the order of the group) that will work for all invertible elements modulo $9p$ at once. However in practice, when $9p$ is large but not so huge that you have difficulty calculating $\phi(9p)$, it helps a lot, if your goal is to explicitly find the least possible $k$, to know that it has to divide $\phi(9p)$.
A: Let F(r,b)=$(111....111)_b$ (r digits, all ones) be a number in base b.
So, F(r,b)=$∑_{0≤t<r}b^t  =(b^r-1)/(b-1)$.
If r|φ($p^k$) where p is prime, then $p^k$ will divide $(b^r-1)$. Again, 
 $p^k$ will also divide $(b^r-1)/(b-1)$ if p∤(b-1). So, $p^k$ will divide $(111....111)_b$ (r digits, all ones) if (p,b-1)=1 and r|φ($p^k$).
If (p,b-1)≠1, then p|(b-1), let k be the highest power of p, that divides (b-1). So b is of the form 1+$p^kq$ where (p,q)=1. Then F(r,b)=$∑_{0≤t<r}b^t=∑_{0≤t<r}{(1+p^kq)}^t$≡r(mod $p^k$) as ${(1+p^kq)}^t≡1(mod\ p^k$) for all integral t≥0. Then, $p^k$ will divide F(r,b) if r|$p^k$ and $p^k|(b-1)$.
Let $p^i$ divides $(a^s-1)/(a-1)$, so $a^s$=1+(a-1)$p^i$d for some integer d.
Then, $a^{sp}=(a^s)^p=(1+(a-1)p^id)^p=1+pC_1(a-1)p^id+...+(a-1)^pp^{ip}d^p$.  Then,$(a^{sp}-1)/(a-1)$ is divisible by $p^{i+1}$. So, if $p^i$|F(s,a) then $p^{i+1}$ will divide F(sp,a) i.e., $(111....111)_a$ (sp digits, all 1's in base a).
Clearly, we shall find some r(the period or the length of 1's) relatively prime with b, such that $p^{m}$ where m is a natural number will divide F(r,b) for any base b.
Now, if n=$p^aq^b$ and $p^a$ divides F($r_p$,b) which is (111...111)$_b$ with $r_p$ digits & $q^b$ divides F($r_q$,b), then n=$p^aq^b$ will divide (111...111)$_b$ with lcm($r_p$,$r_q$) digits and so on for any number n=$p^aq^br^c...\ $  co-prime with the base b.
A: Part 1:
We will show that any rational number $k$ can be rewritten as a fraction $\frac{c}{A}$ where $A$ is the integer composed of $a$ digit 9s followed by $b$ digit 0s, where $a\geq1$ is an integer and $b\geq0$ is an integer, and where $c$ is an integer.
Expressed in decimal notation, all rational numbers either have a finite number of digits (terminating decimals) or they have an infinitely repeating tail (repeating decimals).
If $k$ is a terminating decimal, $k=\frac{x}{10^y}$ for some integer $x$ and some integer $y\geq0$. We can multiply the top and bottom of the fraction by 9 to get $k=\frac{9x}{9\cdot10^y}$. If we pick $a=1,b=y,c=9x$, then $k=\frac{c}{A}$.
If $k$ is a repeating decimal, it equals the sum of a terminating decimal and a repeating tail. For example: $13.47\overline{12}=13.35+0.12\overline{12}=13.35+0.\overline{12}$. (Here repeating tails mean rational numbers that have 0 to the left of the decimal and a repeating pattern starting immediately to the right, such as $0.\overline{12}$ or $0.\overline{00894}$).
Repeating tails that repeat every $z$ digits can be expressed as a fraction where the denominator is composed of $z$ digit 9s:
$0.\overline1=1/9$; $0.\overline{12}=12/99$; $0.\overline{00543}=00543/99999$.
Since a repeating decimal is a sum of a terminating decimal (expressible as $\frac{x}{10^y}$) and a repeating tail (expressible as a fraction where the denominator is $z$ digit 9s) then that sum must be expressible as a fraction with an integer numerator, and an integer denominator that equals $10^y$ times [$z$ digit 9s]. If we pick $a=z,b=y,c=$ the numerator, then $k=\frac{c}{A}$.
Part 2:
We will show that for any integer $n$ that is not a multiple of $2$ or $5$, there is a multiple of $n$ composed of only the digit 1.
Since $n$ is not a multiple of $2$ or $5$, then $n\neq0$, so $\frac{1}{n}$ is a rational number. As shown in Part 1, $\frac{1}{n}=\frac{c}{A}$ where $A$ is the integer composed of $a$ digit 9s followed by $b$ digit 0s, where $a\geq1$ is an integer and $b\geq0$ is an integer, and where $c$ is an integer. We can rearrange to get $cn=A$.
Let $B_1$ be the integer composed of $a$ digit 1s, so $9\cdot B_1\cdot10^b=A=cn$.
Let $B_9$ be the integer composed of $9a$ digit 1s.
Let $q=\frac{B_9}{B_1}$, so $q$ is the integer composed of $9$ digit 1s that are separated with $a-1$ digit 0s between each. This number is a multiple of $9$ since its digits sum to $9$, so $q=9s$ for some integer $s$, so $B_1\cdot9s=B_9$.
$cn=9\cdot B_1\cdot10^b$.
Both sides need to have the same prime factorization, and $n$ doesn't contain any of the factors of $10^b$, so $c$ must contain all of them. This means $c=10^bd$ for some integer $d$.
Cancelling, we get $dn=9\cdot B_1$. Multiplying both sides by $s$, we get $sdn=9s\cdot B_1=B_9$.
$sd\cdot n=B_9$, where $sd$ is an integer, so $B_9$ is a multiple of $n$, and $B_9$ is composed of only the digit 1.
Therefore, for any integer $n$ that is not a multiple of $2$ or $5$, we can find a multiple of $n$ composed of only the digit 1.
