[net.puzzle] my apologies if this goes through twice

osman@sprite.DEC (Eric Osman, dtn 283-7484) (02/12/85)

I originally sent this to RHEA::DECWRL::"net.math,net.puzzles".  I got
an error back saying net.puzzles was wrong, so now I'm sending it to
just net.puzzle.

Newsgroups: net.math,net.puzzles
To: net.math, net.puzzles
Subject: solve 1 + 11 + 111 . . . + n 1's

Let n1 be the last number in the sequence, i.e. n 1's.

The answer for a given n is 1 + 11 + 111 + . . . + n1

	a(n) = (10*n1 - n) / 9

The way I solved it was to observe that the sum is a portion of an infinite
converging geometric series, so I started with the series and shaved off
everything but our desired sum.

The useful geometric series, illustrated for n = 4 is

	1111.111... + 111.111... + 11.111... + 1.111... + .111... +
	.0111... + .00111... + . . .

The first number in the series, 1111.1111... (please continue to allow my loose
flipping  between  example  and  generality) we can represent as the largest
term, L, so we have

	L = n1 + 1/9

If we call the entire geometric series g, we quickly derive value of g,
like this:

First,

	g =        L + L*10^-1 + L*10^-2 + L*10^-3 . . .

Multiply both sides by 10:

   10 * g = L*10 + L + L*10^-1 + L*10^-2 + . . .

Note that g appears in second equation, so we can write it as

    10 * g = L*10 + g

so  finally  we  complete the rederivation of geometric series summation and
have

	g = 10 * L / 9

The first useful thing to strip off are all the 0.111...'s.  There are
exactly n+1 of them.  That's a constant we can call c.

	c = (n+1) * .111... = (n+1) / 9

Next, we want to strip off the residue of all the other non-integer terms
of g, which will finally leave us with what we are looking for.  So
we'll strip off

	r = .0111... + .00111... + .000111... . . .

This is itself a geometric series, computable the same way we did with g,
giving:

	r = 1/81.

The answer we seek of 1 + 11 + 111 + 1111 + . . . + n1 is

	a(n) = g - c - r

Simplifying, this is merely

	a(n) = (10*n1 - n) / 9

Try it for 4.  1 + 11 + 111 + 1111 = 1234.  Does it check ? . . .

	a(4) = (10*1111 - 4) / 9 = (11110 - 4) / 9 = 11106 / 9 = 1234

Yippee !!

At this point, I smiled and went to bed.