0

How many different integers can be expressed as the sum of three distinct numbers from the set{$13$,$10$,$23$,$28$,$33$,$36$,$43$,$48$}?

MyApproach

Out of $8$ numbers, Select $3$ distinct numbers.

So Ans would be $8$C$3$=$56$-2=$54$.

Because $2$ numbers have equal sum($10$+$23$+$48$ gives an integer which is also obtain from $10$+$28$+$43$

.Similarly $10$+$23$+$33$ can also b obtain from $10$+$13$+$43$.)

Hence $56$-$2$=$54$

Am i right in my approach?

justin takro
  • 1,288
  • Did you mean 36? The other numbers make a nice pattern which can be exploited. 38 would fit better. :) $$$$ Hmm actually you don't have 18 there so the pattern isn't that strong. – Ian Miller Nov 16 '15 at 07:05

2 Answers2

1

Right approach. Incorrect counting. Expanding upon your answers we see: $13+43+x=23+33+x$ and $23+48+x=28+43+x$. Here $x$ could be any of the 4 unused numbers in each set. There are several other examples like that too.

Ian Miller
  • 11,844
0

These kinds of questions seem good to start with a programming approach. Maybe that's gauche, but call me gauche! This Java snippet loops through all 3-tuple and uses the uniqueness constraint of HashMaps to find the unique answers:

public static void  main(String [] args) {
    int [] array = {13,10,23,28,33,36,43,48};
    HashMap<Integer, Integer> uniques = new HashMap<Integer, Integer>();
    for (int i = 0; i < array.length -2; i++) {
        for (int j = i + 1; j < array.length -1; j++) {
            for (int k = j + 1; k < array.length; k++) {
                int sum = array[i] + array[j] + array[k];
                uniques.put(sum, sum);
            }
        }
    }
    ArrayList<Integer> values = new ArrayList<Integer>(uniques.values());
    Collections.sort(values);
    for (Integer unique: values) {
        System.out.print(unique + ",");
    }
    System.out.println("\nThe number of unique sums is: " + uniques.size());
}

This prints:

    46,51,56,59,61,64,66,69,71,72,74,76,77,79,81,82,84,86,87,89,91,92,94,97,99,101,102,104,107,109,112,114,117,119,124,127

The number of unique sums is: 36
Brian Risk
  • 101
  • 4