×

# how to make N numbers EQUAL by adding only 1,2 and 5

How to make N numbers equal by addin only 1, 2 or 5? You can choose as many of N numbers and add 1, 2 or 5? Result is the minimum number of addition operation?

Example:; 2, 2, 3, 7 are numbers......... then adding 1 to all exept third will give 3, 3, 3, 8........ now add 5 to all exept last give 8 8 8 8......... so for this min number is 2

Pls suggest a solution strategy, which we can apply to any set of numbers

Note by Akash Goyal
4 years, 4 months ago

Sort by:

I think i got it......

1). find 1st minimum & 2nd minimum

2). calculate difference. between 1st & 2nd min

3).add the difference to all elements, except the 2nd minimum.

Repeat this till all elements become equal.

Example: 2,2,3,7

2nd min-1st min = 2-1 = 1

so, 3,3,3,8

2nd min-1st min = 8-3 = 5

so, 8,8,8,8

total steps=2

If the difference is not 1,2,5, then it sud be arranged in form of addition of 1,2,5.

example: 10=5+5, 9=5+2+2

- 4 years, 4 months ago

$$0,1,2,3$$.

The best solution uses 2 additions:

• Add 1 to $$0,2$$, giving $$1,1,3,3$$
• Add 2 to $$1,1$$, giving $$3,3,3,3$$

• Add 1 to $$0,2,3$$, giving $$1,1,3,4$$
• Add 2 to $$1,1,4$$, giving $$3,3,3,6$$
• Add 2 to $$3,3,3$$, giving $$5,5,5,6$$
• Add 1 to $$5,5,5$$, giving $$6,6,6,6$$

I believe this is a fairly difficult problem. My best strategy at the moment is somewhere like this:

Determine the differences between each number and the maximum. Express the differences in as few terms as possible, and clear them up as efficiently as possible. This means applying as many 5s as possible to clear the maximum difference, then applying at most two 2s and one 1 for the remainders ($$0 = 0, 1 = 1, 2 = 2, 3 = 2+1, 4 = 2+2$$; in all cases, only two 2s and one 1 are required).

I claim the above is at most 2 away from the best solution. I'm thinking of a better solution (or otherwise a rigorous proof that the above strategy is actually the best solution).

- 4 years, 4 months ago