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?"
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
Originally posted by wolfgang59I 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...
Nice one. I didnt think the solution was unique!
Originally posted by FabianFnasEdited while I think about it some more...
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.)