How many natural numbers less than 10000 have the sum of their digits equal to 5?

Pop Quiz | Math

Ta Da!

  • Dec. 30, 2009

Arthur T. Benjamin has two passions: magic and math. When not amazing audiences around the country — squaring five-digit numbers in his head or guessing your number, any number — the Mathemagician is a professor of math at Harvey Mudd College in Claremont, Calif. There’s even whimsy to his Ph.D. dissertation, at Johns Hopkins, titled “Turnpike Structures for Optimal Maneuvers”: the maneuvers were inspired by a way of arranging Chinese checkers to move expeditiously across the board. Below, Dr. Benjamin shares some of the concepts from his DVD course “The Joy of Mathematics” and his book “Secrets of Mental Math: The Mathemagician’s Guide to Lightning Calculation and Amazing Math Tricks.”

Follow the instructions below. I bet I can predict your answers. How do I do it? Explanations follow.

1. Choose a number from 1 to 70 and then divide it by 7. (I’ll be nice and let you use a calculator, but you’ll need one that has at least seven decimal places.) If your total is a whole number (that is, no digits after the decimal point) divide the answer by 7 again. Is there a 1 somewhere after the decimal point? I predict that the number after the 1 is 4. Am I right? Now add up the first six digits after the decimal point.

Your answer is 27.

How do I do it?
The six fractions 1/7 to 6/7 have the same repeating sequence of six numbers after the decimal point, each fraction starting with a different number in the sequence 142857. Think of these numbers as in a circle (Diagram A), and going around that circle forever.

The first number after the decimal point in the decimal version of 1/7 is 1 (.142857); of 2/7, 2 (.285714); of 3/7, 4 (.428571); of 4/7, 5 (.571428); of 5/7, 7 (.714285); and of 6/7, 8 (.857142). Adding 1, 4, 2, 8, 5 and 7, you always get 27.

2. Choose your favorite number from 1 to 100. Double it, then add 5. Now multiply by 50, then add 1,759. If you have had your birthday already in 2010: happy birthday and add 1 to the total. Subtract the year you were born.

Your answer begins with your favorite number, followed by your age.

How do I do it?
As with most of this mathematical magic, the secret is elementary algebra. Suppose your favorite number is x. Double it, for 2x; add 5, for 2x + 5; then multiply by 50, for 100x + 250. Adding 1,759 gets you 100x + 2009. Subtracting the year you were born (and adding the number 1 if you had your birthday already this year) will produce your favorite number followed by your age.

Note: This trick will fail if you are more than 99 years old.

3. Choose a number from 1 to 20. Double it, add 10, divide by 2, and then subtract the number you started with. (Based on what you learned with Problem 2, you should be able to predict this number along with me.)

Your number is 5.

How do I do it?
After doubling x, you have 2x; add 10 and it becomes 2x + 10. Then divide by 2 and it becomes x + 5. After subtracting the original number x, you have 5.

4. Use any A.T.M. card or credit card with 16 digits. Write the number in a grid of boxes like the one shown in Diagram B, in alternating fashion. For example, if your card number is 3141592653589793, then your numbers would be 34525599 and 11963873.

Image

Credit...Photo Illustration by Richard Faverty/Beckett Studios

Add up the digits of the top number, then double it. Write that number down.

Add up the digits of the bottom number. Write that number down.

How many of the digits of the top number are 5 or greater? Write that down.

Now add the three numbers you wrote down, and look at the last digit of your answer.

Is the last digit 0?

How do I do it?
There’s no magic here. This is the Luhn system used for credit and A.T.M. cards. The steps you just took are what happens automatically when you use your card. A wrong digit or transposing nearly any two consecutive digits in your 16-digit card number can be detected, without using a database, because the final digit of the total won’t add up to 0. See for yourself. Do the math and your last digit will be 0. Change any number on your card and it won’t.

5. Choose a four-digit number, with each digit different. Scramble the digits to create a new number. (For instance, if your first number is 2,357, your second number might be 7,325.) Subtract the smaller number from the larger, and add together the digits of the resulting number. If your sum is one digit, go no further. If your sum is a two-digit number, then add the two digits together.

Your number is 9.

How do I do it?
Here’s a two-part explanation for how this trick works, thanks to the amazing properties of 9.

First, when you subtract the smaller number from the larger one, the result is always a multiple of 9. This happens because, when you divide any number and any scrambled variation of it by 9, the remainder — what’s left over after dividing — is always the same. (You'll have to trust us on why. It's based on "casting out nines.") For example, 28 divided by 9 is 3 with a remainder of 1. Swapping the digits, for 82, and dividing by 9 gives 9, and again the remainder is 1.

Hence, when subtracting the smaller number from the larger one, the identical remainders will cancel each other out, and the result is — poof! — a multiple of 9.

Algebraically, what you have is (9x + r) - (9y + r) = 9(x - y).

Second, every multiple of 9 (9, 18, 27, 36, etc.) has the property that its digits will always add up to a multiple of 9. For example, the number 4,968 is a multiple of 9 (552 × 9), and its digits add up to 27 (3 × 9).

Because of how the problem is stated, with four-digit numbers, the sum of the digits will always be 9 or 18 or 27. Adding 1 + 8 or adding 2 + 7 (as specified in the problem) again gives 9.

6. In the highlighted grid on the calendar (Diagram C), circle four dates so there is one circled in each row and each column. Add the four circled numbers.

Your total is 64.

How do I do it?
Look at the Sunday dates, to the left of the grid (Diagram E).

Now think of the numbers for Monday through Thursday as simply those Sunday numbers plus 1, 2, 3 or 4.

In choosing four numbers from different rows and columns, you are just adding the Sunday numbers (54) plus 1 + 2 + 3 + 4 (10), which equals 64.

7. In a table like the one shown in Diagram D, write any number in Rows 1 and 2. Add those numbers, and put the total in Row 3. Add the numbers in Rows 2 and 3, and put the answer in Row 4. Continue this process until you have numbers in all 10 rows. Now add up the 10 numbers and divide by the number in Row 7.

Your answer is 11.

How do I do it?
Suppose you start with the number x in Row 1 and number y in Row 2. Then Row 3 will be x + y, which leads to Row 4 being x + 2y, and so on. Diagram F shows what the final table looks like.

The grand total is 11 times 5x + 8y. Note that 5x + 8y is in Row 7. Hence, dividing the total by what’s in Row 7 will always yield the answer 11.

Tip: To look like a human calculator, ask somebody to write numbers in the table, as before. When he shows you the list, make a great show of “mind reading” and challenge him to add all the numbers with a calculator faster than you can in your head. Just multiply Row 7 by 11.

The skill of math is not in juggling a multitude of numbers. The skill is in recognizing a pattern that greatly simplifies the calculation. The following problems can be easily done in your head if you know the tricks.

8. To get the sum of all the numbers from 1 to 100, punching 1 + 2 + 3 . . . into a calculator isn’t the fastest route. So, what’s the sum? Quick. (The great German mathematician Carl Friedrich Gauss supposedly solved this problem in his head as a boy, an early indication of his genius.)

How do I do it?
The trick is realizing that 1 + 100 is 101, as is 2 + 99 and 3 + 98 and so on, through 50 + 51. That’s 50 pairs of numbers that each add up to 101. So the answer is 50 × 101. That’s 5,050.

9. Now, what’s the sum of the odd numbers from 1 to 99?

How do I do it?
Use what you just learned. You have 25 pairs, giving 2,500.

10. Without a calculator, determine 2,317 divided by 25. (Hint: multiply, don’t divide.) Compute to two decimal places.

How do I do it?
Because 1/25 is 4/100, to divide any number by 25 you simply multiply it by 4, then divide by 100. Here, we multiply 2,317 by 4 (getting 9,268), then divide by 100 to get 92.68.

How many numbers less than 1000 will have a digit sum equal to 5?

The three digit numbers are: 104, 113, 122, 131, 140, 203, 212, 221, 230, 302, 311, 320, 401, 410, 500. In total, we have 21 natural numbers with a sum of the digits equal to 5.

How many natural numbers less than 1000 have exactly 5 factors?

The natural numbers less than 1000 have exactly 5 factors are 16,81,625. The factors of 16 are 1, 2, 4, 8, 16. The factors of 81 are 1, 3, 9, 27, 81. The factors of 625 are 1, 5, 25, 125, 625.

How many natural numbers less than 10,000 can be formed?

Hence, there are 4096 numbers less than 10000 which can be formed from the given digits.

How many natural numbers less than 1000 can be formed with 12345?

Hence, the total number of natural numbers is 215.