Associated Topics || Dr. Math Home || Search Dr. Math

### Sum of First Four Digits Equals Units Digit

```
Date: 10/20/2001 at 17:15:03
From: James
Subject: Mathcounts Workout 8 1995-96

How many even five-digit numbers have the property that the sum of the
first four digits is the units digit?

I tried to solve it by patterning.

Even numbers means that it end with 0, 2, 4, 6, and 8.

0 is obviously not the case since only 0's add up to 0, and no
negative digits are possible.

Possibilities for four numbers adding up to 2 are 2+0+0+0, 1+1+0+0,
and all their permutations that don't begin with 0. That makes four
five-digit numbers fitting the property.

Possibilities for four numbers adding up to 4 are 4+0+0+0, 3+1+0+0,
2+2+0+0, 1+1+2+0, 1+1+1+1, and all their permutations. That makes 20
possibilities (the number of permutations are 1, 6, 3, 9, and 1
respectively).

I tried 6, but there are just too many combinations. Can you please
show the correct way to solve it? (I suspect a formula.)
```

```
Date: 10/21/2001 at 00:13:31
From: Doctor Schwa
Subject: Re: Mathcounts Workout 8 1995-96

Hi James,

I think that sounds like a great plan for solving the problem.
It does get to be a bit messy, but ...

Perhaps instead I'd try organizing the patterns by the first digit
(since its non-zeroness makes it kind of a pain to count the
permutations of the other things). I'll try that and see how it goes.

If it starts with 8, then the number can only be 80008.

If it starts with 7, then it's 7xxx8, where there's one 1 out of the
three x's, so three permutations.

If it starts with 6, it can be 60006 or 6xxx8, where the three x's
add up to 2 ... and, aha! There is an easy way of figuring out the
number of ways of doing that (and all the similar problems). Now that
I think about it, the same way works for your case where the first
number must be nonzero.

Suppose you know there are four numbers that add up to 4. Then to make
the numbers add up to 4, we'll put four o's, each o standing for one
unit.

To split the o's into four numbers, we'll use three |'s as dividers.

Then we just have to put four o's and three |'s in some order, like
oo||o|o which would mean 2011, or
||ooo|o which would mean 0031.

Since the first number can't be zero, though, we'll just hold on to
one of the o's and, after arranging the rest, put it in the leftmost
spot.

There are (6 choose 3) = 6! / (3! (6-3)!) = 20 ways of arranging the
three o's and the three |'s. That just perfectly matches the result
you got above.

So my formula predicts that if you have four numbers adding up to six,
there will be six o's and three |'s, and hence 9 choose 3 ways of
doing it (which is 84). But that includes the one where the first
digit is zero; when we hold one of the o's in reserve, there'll be
8 choose 3 ways of doing it (which is 56).

I hope that explanation makes some sense. It's a pretty sneaky method.
Maybe there's an easier way of producing the same formula...

- Doctor Schwa, The Math Forum
http://mathforum.org/dr.math/
```
Associated Topics:
High School Permutations and Combinations
High School Puzzles

Search the Dr. Math Library:

 Find items containing (put spaces between keywords):   Click only once for faster results: [ Choose "whole words" when searching for a word like age.] all keywords, in any order at least one, that exact phrase parts of words whole words

Submit your own question to Dr. Math
Math Forum Home || Math Library || Quick Reference || Math Forum Search