Summin’ 1s

On Jimmy Salvatore’s awesome math blog, Dying Lovegrape, he considers the fun problem of finding the sum 1+11+111+\ldots+11111\ldots In the course of thinking about the problem, he finds some interesting methods for speeding up the addition process, but ultimately yearns for a closed form solution like a scurvied pirate for a lime tree. Here we present such a solution, which uses a trick we used in a past post on credit cards and amortization.

The first step is to look at the terms in the series, 1,11,111,1111, etc. What we can notice is that any number in the sequence is just the previous number multiplied by 10 and added to 1. For instance, 1111=10(111)+1. Let’s turn this into an analytic expression by promoting the multiplier 10 to the variable r. And, as an example, let’s say we want to calculate 4th term in the sequence in terms of r. When we perform this algorithm, we are evaluating the expression

(((1*r+1)*r+1)*r+1)

which, as we shown in the amortization post, expands to

r^3+r^2+r+1

which is a geometric series. This particular term is equal to \frac{r^{4}-1}{r-1} and in general, the nth term is equal to \frac{r^{n}-1}{r-1}.

So, this gives us a neat way of writing each term in the sequence, all of which we must now sum together.

I.e., if we end at the nth term, the sum is t_n, we must find t_1+t_2+\ldots+t_n

We can write this analytically as

\sum\limits_{h=1}^{n}\frac{r^{h}-1}{r-1}=\frac{1}{r-1}\sum\limits_{h=1}^{n}\left(r^{h}-1\right)

Of course, all of the 1′s in the sum just add up to n, so the only thing left to do is to add up all of the terms r^{h}, but we have already done this, and it is again a finite geometric series. The only trick we do is to pull a factor of r in front of the sum so that we have the typical geometric series, i.e.

\frac{1}{r-1}\left(r\sum\limits_{h=0}^{n-1}r^{h}-n\right)

now, it is clear that upon evaluating the geometric series in the last expression that we will get

\frac{1}{r-1}\left(\frac{r}{r-1}\left(r^{n}-1\right)-n\right)=\frac{1}{(r-1)^2}\left(r^{n+1}-(1+n)r+n\right)

Now, if we plug in r=10 as it is in the original problem, we find that the sum of the first n terms is given by  the closed form expression \frac{1}{81}\left(10^{n+1}-10-9n\right). Below, we plot the function along with data points from summing the first 1, 2, 3, 11 and 13 terms on a calculator.

Finally, we evaluate the formal expression for values of n from 1 to 30. As expected, they agree with the partial sums found by hand. The number in the left column corresponds to the number of terms and the number on the right is the sum of the terms.

Update

I realized that the comparison of Jimmy and a scurvied pirate is all the more delightful, since at one point in his life (unless I am mistaken), he actually gave himself scurvy (in the 21st century no less) via his surreal infatuation with eating sauteed mushrooms, and evidently, little other than sauteed mushrooms for months on end. I love Jimmy more than I can really know.

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.
Theme: Esquire by Matthew Buchanan.

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: