1

Question:

  • There is a set of numbers defined as {A, B, C, D, E}
  • The sum of the set is 49 (A+B+C+D+E = 49)
  • The product of the set is 13000 (ABCDE = 13000)

    1. Can you determine the values of A, B, C, D, and E?
    2. Is there more than one possible solution? (Assuming switching values does not count as another solution i.e. switching A and E is not another solution)

The answer is {1, 5, 10, 13, 20} though I am looking for a process to solve it. If you can only prove that it is true or untrue please answer. (This will be done by a computer so complexity is not an issue)
To clarify, this is a personal project, not homework help.
Thanks in advance!

Peake
  • 13
  • 2
  • FindInstance[{a+b+c+d+e==49, a* b* c* d* e==13000}, {a,b,c,d,e}, Integers] finds one solution in a minute. You may want to include additional conditions if you want to limit the solution further. – Bill Apr 19 '17 at 06:09

3 Answers3

4

A very quick, brute force way:

With[{partitions = IntegerPartitions[49, {5}]}, 
 Pick[partitions, Times @@@ partitions, 13000]
]
{{25, 13, 5, 4, 2}, {20, 13, 10, 5, 1}}
Quantum_Oli
  • 7,964
  • 2
  • 21
  • 43
1

The answer is {1, 5, 10, 13, 20}

Mathematica finds this answer

eq1  = a+b+c+d+e==49;
eq2  = a b c d e ==13000;
sol  = FindInstance[eq1&&eq2,{a,b,c,d,e},Integers]

(*  {{a->-20, b->-2, c->1, d->5, e->65}}  *)

eq1/.sol
eq2/.sol

Mathematica graphics

though I am looking for a process to solve it

Using Mathematica? one way is to

 sol=Reduce[eq1&&eq2,{a,b,c,d,e},Integers]

Mathematica graphics

Nasser
  • 143,286
  • 11
  • 154
  • 359
1

The simple, direct (and best) answer by @Quantum_Oli finds (positive) integers summing to the required 49, then picks those sets with product 13000. This process may be reversed by finding sets with the required product, then picking those sets with the required sum. Thus, first look for the multiplicative partitions of 13000. See, for example, here. Below is the function f[n,k] by @Mr.Wizard from this question. See also the Mathmatica Journal article by Knopfmacher and Mays.

f[n,k] finds the multiplicative partitions of n into k parts.

Clear[f];
mem : div[n_] := mem = Divisors@n
mem : div[n_, k_] := mem = #~Take~Ceiling[Length@#/k] &@div@n
f[n_, 1, ___] := {{n}}
mem : f[n_, k_, x_: 2] := 
   mem = Join @@ 
      Table[If[q < x, {}, {q, ##} & @@@ f[n/q, k - 1, q]], {q, n~div~k}]

There are no multiplicative partitions of 13000 into {1,1,1,D,E} or {1,1,C,D,E} which sum to the correct value.

Select[f[13000, 2], Plus @@ # == 46 &]
Select[f[13000, 3], Plus @@ # == 47 &]

There is one multiplicative partition of 13000 into {1,B,C,D,E} summing to 49.

Map[Join[{1}, #] &, Select[f[13000, 4], Plus @@ # == 48 &]]

{{1, 5, 10, 13, 20}}

There is one multiplicative partition of 13000 into {A,B,C,D,E} summing to 49.

Select[f[13000, 5], Plus @@ # == 49 &]

{{2, 4, 5, 13, 25}}

KennyColnago
  • 15,209
  • 26
  • 62
  • Thanks a ton for taking the time to write this and presenting that second solution. I can't upvote (too low rep) though I'm really thankful! – Peake Apr 20 '17 at 00:01