Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find the largest sum and smallest positive difference?

Using the numbers 9, 8, 7, 6, 5, and 4 once each, find the following:

a) The largest possible sum

Is there more than on solution that gives the largest possible sum? How do you know it's the largest possible sum?

b) The smallest possible (positive) difference

Is there more than one solution? How do you know it's the smallest possible difference?

The numbers must be 3 digits. For example, 965 + 784 or 879 - 654

like image 717
user2856199 Avatar asked Oct 07 '13 20:10

user2856199


1 Answers

Hmm interesting

Difference:

If you always take tupels (a_1,b_1),(a_2,b_2),(a_3,b_3) for a_1a_2a_3-b_1b_2b_3, the difference is:

100*(a_1-b_1)+10*(a_2-b_2)+(a_1-b_1)

So for the smallest difference I guess this should be fullfilled: -(a_2-b_2) > -(a_3-b_3) > (a_1-b_1):

(a_2-b_2) = 4-9 = -5 = d_2
(a_3-b_3) = 5-8 = -3 = d_3
(a_1-b_1) = 7-6 =  1 = d_1

giving you 745-698 = 47 which is the only smallest because in all other variants d_2 will be bigger or d_3 will be bigger or even d_1. Also its unique (so just one solution) because it's asked after the positive difference, so you cannot switch the numbers.

Sum:

So for the sum we got:

100*(a_1+b_1) + 10*(a_2+b_2) + (a_2+b_2)

so now: (a_1+b_1)>(a_2+b_2)>(a_3+b_3):

a_1+b_1 = 8+9 = 17
a_2+b_2 = 7+6 = 13
a_3+b_3 = 4+5 = 9

so it's 964+875 = 975+864 = 1839, it's not unique, but still the biggest. For you can change b_i and a_i you have 2^3 possiblities to build this sum.

like image 174
mjb4 Avatar answered Sep 24 '22 00:09

mjb4