<s>[INST] Proving sum of product forms a pattern in n * nnnnnn.... I am consider a problem regarding numbers which are, in decimal, one digit repeated - for instance, $88888888$ is such a number. In particular, I am looking at the following problem:

The sum of the digits of the number $$8\cdot \underbrace{88\ldots 88}_{n\text{ times}}$$ is $1000$. How many $8$'s are there? (i.e. what is $n$?)

I know that the correct answer is $991$ and I can observe a pattern that lets me solve it; in particular, the sum of digits of $8\cdot 8=64$ is $10$ and the sum of digits of $8\cdot 88=704$ is $11$ and the sum of digits of $8\cdot 888=7104$ is $12$ - so it appears that the sum of the digits is exactly $n+9$. One can note that if one replaces all the eights with other digits, similar patterns exist - for instance, with sevens, the sum increases by $4$ for each digit.
How can this pattern be proven?
 [/INST] $a*aaaa....aaa = a^2*1111111....111$ (m a's and m 1's)
Three cases to consider:
$a^2$ has one digit. (i.e. $a = 1,2,3$)
$a^2$ has two digits and the sum of the digits is less than 10. (i.e. $a = 4,5,6, 9$)
$a^2$ has two digits and the sum of the digits is 10 or more. (i.e. $a = 7,8$)
====
If $a^2 = b$ has one digit,$b$, then $a*aaa... = a^2*111... = bbbbb$ and the sum of the digits is $m*b$.  That was easy.
===
If $a^2 = 10b + c$ has two digits, $b$ and $c$, and $b + c < 10$ then:
$a*aaa... = a^2*1,1,1... = (10b+c),(10b + c),...,(10b + c) = b,(b+c),(b+c),...,(b + c), c$.
[Here I use notation x,x,x ... as shorthand for $\sum x*10^i$.  In the $b,(b+c),...,(b+c), c$ each term is a single digit although it wasn't for the $(10b+c),(10b+c)...$ representation.  But from that one we "carried the b's" to get the final representation.]
The sum of the digits $b,(b+c),(b+c),...,(b + c), c$ is $b + (m-1)(b+c) + c= m(b+c)$.
===
If $a^2 = 10b + c$ is two digits ($b$ and $c$) and $b + c = 10 + d$ for some digit d...
First note that $d < 9$ so $d + 1 < 10$.
So  $a*a*1111... = a^2*1111.... = (10b +c),(10b + c), .... (10b + c),(10b + c) = b,(b + c),....(b+c),c = b,(10 + d),(10 + d), .....(10 + d),c = (b+1),(d+1),(d+1),....(d+1),d,c$.
And the sum of the digits is $b + 1 + (m-2)(d+1) + d + c = b + c + d+ (m-2)(d+1) = 11 + 2d + (m-2)(d +1) = m(d+1) + 9$.
====
In summary:  Sum of digits = $m*e \{+ 9 \}$ where $m$ is the number of digits and $e$ is the $a^2$, sum of digits of $a^2$, or sum of sum of digits of $a^2$ and $" + 9"$ applies only if sum of digits of $a^2 \ge 10$.
And hence, each increase in $m$ the sums increase by $e$.
===
And, BTW, back to the original problem: Su of digits of $a*aaaa....$ = 1000- how many digits are there:
Sum of digits is $m*e \{+9\} = 1000$.  $e$ can be: $a=1 \implies e =1;a=2 \implies e =4;a=3 \implies e =9;a=4 \implies e =7;a=5 \implies e =7;a=6 \implies e =9;a=7 \implies e =4;a=8 \implies e =1; a=9 \implies e =9;$ 
$m*e = \{1000, 991\}$.  $991$ is primes so if $m*e = 991$ then $e = 1; a=8; m=991$. If $m*e = 1000$ then $e$ is 1 or a multiple of 2 or 5 only, so possibilities:
$e = 1;a = 1; m = 1000; $
$e = 4; a = 2; m = 250;$
$e = 4; a =7$ is not possible as that would imply $m = 991$.
Three answers.
</s>