There are only 9000 cases

Find the sum of all 4-digit numbers a b c d \overline{abcd} such that ( a + b ) ( a + c ) ( a + d ) ( b + c ) ( b + d ) ( c + d ) = a b c d . (a + b)(a + c)(a + d)(b + c)(b + d)(c + d) = \overline{abcd}. If you think there are no such numbers, submit 1 -1 as the answer.


The answer is 2016.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

3 solutions

Giorgos K.
Apr 5, 2018

using Mathematica

Select[Range[1000,9999],(s=#;Times@@Total/@(IntegerDigits[s][[#]]&/@Subsets[Range@4,{2}])==#)&]

returns only one number, 2016

Kyle Gray
May 9, 2018

One of my many solutions, this particular solution was written in JavaScript:

let solution = 0
for(let x = 1000; x < 10000; x++) {
    [a, b, c, d] = x.toString().split('').map(v => Number(v))
    if ((a+b)*(a+c)*(a+d)*(b+c)*(b+d)*(c+d) == x)
        solution += x
}
console.log(solution)
Bruno Neves
Apr 5, 2018
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#Dirty Solution , but it works anyway
import numpy as np
ans = []
for i in xrange(1000,10000):
    digits = [0]*4
    n = i
    for j in range(4):
        digits[3-j] = n%10
        n/=10
    [a,b,c,d] = digits
    if (a+b)*(a+c)*(a+d)*(b+c)*(b+d)*(c+d) == i:
        ans.append(i)
print np.sum(ans)

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...