Sum x Product

There are a few special numbers that are equal to the product of the sum of the digits and the product of the digits. For example, 135 ( 1 + 3 + 5 ) × ( 1 × 3 × 5 ) = 135 135 \rightarrow (1 + 3 + 5) \times (1 \times 3 \times 5) = 135 . 1 1 also has this property. What is the only other positive integer less than 1000 1000 that also has this property?


The answer is 144.

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

Steven Chase
Dec 2, 2018
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# https://brilliant.org/problems/sum-x-product/

for j in range(1,1000):

    hunds = j / 100
    tens = (j - 100*hunds) / 10
    ones = j - 100*hunds - 10*tens

    q = (hunds + tens + ones) * (hunds * tens * ones)

    if q == j:
        print j

# Results
#135
#144

You used which software?

Mr. India - 2 years, 3 months ago

Log in to reply

It is Python

Steven Chase - 2 years, 3 months ago

Log in to reply

Ok thank you.will try to learn it!

Mr. India - 2 years, 3 months ago
David Stiff
Jan 18, 2019
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
for i in range(1001):
    numbers = [num for num in str(i)]
    sum = 0
    product = 1
    for num in numbers:
        sum += int(num)
        product *= int(num)
    if sum*product == i:
        print(i) 

# This yielded a result of 0, 1, 135, and 144
# However, since we have already been told that 1 and 135 are candidates, and that we are looking for a positive integer,
# our final answer will be 144

Joshua Lowrance
Nov 27, 2018

144 ( 1 + 4 + 4 ) × ( 1 × 4 × 4 ) = 144 144 \rightarrow (1 + 4 + 4) \times (1 \times 4 \times 4) = 144 . Also view this OEIS page .

What is this page?

Mr. India - 2 years, 3 months ago

Log in to reply

On the right hand side, it has the numbers 1 to 1000, and on the left it has the number you get when you multiply the sum of the digits to the product of the digits.

Joshua Lowrance - 2 years, 3 months ago

Log in to reply

Oh, i didn't see the right.

Mr. India - 2 years, 3 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...