# Five numbers

FabianFnas
Posers and Puzzles 04 Jan '08 10:55
1. 04 Jan '08 10:55
The sum of 5 integers is 25.
The product of the same 5 integers is 2520.
What are the numbers?
2. celticcountry
04 Jan '08 11:012 edits
Originally posted by FabianFnas
The sum of 5 integers is 25.
The product of the same 5 integers is 2520.
What are the numbers?

*EDITED METHOD*
3. 04 Jan '08 11:42
Originally posted by celticcountry

*EDITED METHOD*
It took six minutes for you to figure this one out!
(He mailed the answer to me)
4. 04 Jan '08 12:391 edit
2520 = 2x2x2x3x3x5x7
2+2+2+3+3+5+7 = 24 and is 7 numbers, so we need to get to 25 by combining two of the numbers.
2+2+6+3+5+7 = 25 and is 6 numbers, so combine the two which doesn't change their sum.
4+6+3+5+7 = 25 and 4x6x3x5x7 = 2520.

as this is the only answer, a nicer question might have been "5 numbers have a sum of 25 and product of 2520. Are the number's consecutive?"
5. wolfgang59
04 Jan '08 12:46

the answer pops out when you realise 5 numbers adding to 25 are gonna be averaging 5....

anyone clever enough to prove answer is unique? I'm not!
6. Mitsurugi
04 Jan '08 15:241 edit
def notInSolutions(sols, i1, i2, i3, i4, i5):
for sol in sols:
if i1 in sol and i2 in sol and i3 in sol and i4 in sol and i5 in sol:
return False
return True

solutions = []
for i1 in xrange(25):
for i2 in xrange(25):
for i3 in xrange(25):
for i4 in xrange(25):
for i5 in xrange(25):
if i1+i2+i3+i4+i5 == 25 and i1*i2*i3*i4*i5 == 2520:
if notInSolutions(solutions,i1,i2,i3,i4,i5):
print i1,i2,i3,i4,i5
solutions.append([i1,i2,i3,i4,i5])

Run this in Python and you'll find out that the only solution is any combination of the one posted above 🙂

EDIT: The editor here messed up my tabs so you'll have to actually tab it correctly for it to work in Python. Nevertheless notice that this is not an optimal implementation of a solver for this problem :p
7. 04 Jan '08 16:41
Thank you all of you for the effort.
Yes, the numbers are 3, 4, 5, 6, and 7

Trial and error is on good method, but I liked the faktorisation!

If the integers don't have to be positive, is there any more solutions then? (I don't know myself.)
8. 04 Jan '08 16:57
Originally posted by wolfgang59

the answer pops out when you realise 5 numbers adding to 25 are gonna be averaging 5....

anyone clever enough to prove answer is unique? I'm not!
No, it's not unique. We're working over the integers, so {21, 5, 4, -3, -2} works.
9. wolfgang59
04 Jan '08 21:10
Nice one. I didnt think the solution was unique!
10. 04 Jan '08 21:18
Originally posted by wolfgang59
Nice one. I didnt think the solution was unique!
I actually assumed it was a trick question and was looking for positive and negative numbers from the start. It was only after I had my solution that I read the rest of the thread, and that actually I was being overly complicated...
11. Mitsurugi