Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can you divide $40$ to $4$ parts such that every number from $1-40$ can be realized just by adding or subtracting those $4$ parts?

share|cite|improve this question
See the balanced ternary number system. – Marc van Leeuwen Dec 13 '12 at 12:41
up vote 3 down vote accepted

All integers from 1 to 40 can be expressed by adding or subtracting 1,3,9 and 27 in such a way that each number is used at most once, and it should be either added or subtracted.

share|cite|improve this answer
You mean, "each number is used at most once". – TonyK Dec 13 '12 at 13:25
Oops. That's true. – Host-website-on-iPage Dec 29 '12 at 7:04

My answer is the same as Aneesh, but I'll try to give some informal intuition/justification of the answer. Think of it this way: What numbers would you have needed if you could only add them atmost once? So, you could say that the coefficients of each of these numbers would be either 0 or 1. This translates to the binary number system, and you would require 1, 2, 4, 8, 16, 32 to generate all numbers from 1 to 40 (all powers of 2 less than 40).

Now look at your question. Going on similar lines, the appropriate coefficients would be -1, 0 and 1. You can treat it as a base-3 (ternary) number system, and you would need all the powers of 3 (less than 40) to generate all numbers from 1-40, namely: 1, 3, 9 and 27.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.