All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Digital Product Triples (Posted on 2023-09-05) Difficulty: 3 of 5
The digital product P(N) of an integer N is the product of its decimal digits.

For example, P(128)=16.

Find all sets of three positive integers A, B and C such that:
A = P(B)+P(C)
B = P(A)+P(C)
C = P(A)+P(B).

See The Solution Submitted by K Sengupta    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Some Thoughts Computer solution | Comment 2 of 4 |
(May very well not be a complete solution; so findings)
I found:
(36,36,36) and
(498, 498, 576)
I did not find 5,5,10 because pod(10) = 0
[Corrected after Charlie's next post:  (5,5,10) is indeed a solution, I made the initial blunder of eliminating all numbers that included a '0', I have commented out those lines of code below]

Part One:  all equal
First, try A=B=C.  Summing the 3 equations then shows A = 2*P(A).
A quick search up to 1000, for i == 2*pod(i) shows 36 with pod=18 (and 0, 0).
Proof that no number larger than 2 digits has this property:
Suppose a 3-digit num has n = 2*pod(n)  (call a,b,c its digits)
100a + 10b + c = 2abc
100a + 10b = (2ab - 1)c  ; c must be even since (2ab - 1) is odd.
10(10a + b) = odd * c ; c must end in zero, but it's only one digit
so c=0 but then pod(abc) = 0.
So for n more than 2 digits, the pod is zero, so no such n exists
Thus (36,36,36) is the only solution where A=B=C.

Part Two:  two equal
Subtract one equation from another:
A - B = P(B) - P(A) (true for all pairs of ABC)

Find pairs of integers s.t. A - B = P(B) - P(A)
Once you find such a pair, it is possible that A,A,B or A,B,B is a solution.  If true then the 2 to 1 weighted average of A,B must be double the 2 to 1 weighted average of pod(A),pod(B); or just check if A+A+B = 2(P(A)P(A)P(B))
(and also check for ABB)
The second part of the code prints out:
498 576 288 210   78
[[498, 498, 576]]

Part Three:  all unique
I then started an analytic approach for if A,B,C are all unique; but no progress so far.

-----------------
from itertools import combinations_with_replacement
def pod(n):
    """ Input an integer.  Returns the Product of the Digits  """
    aList = list(str(n))
    ans = 1
    for c in aList:
        ans = ans * int(c)
    return ans

for  i in range(1,1000):
    if i == 2*pod(i):
        print(i,pod(i))

big = 10000
ans = []
for i in range(big):
#    if '0' in str(i):              #commented out, see correction above
#        continue                 #commented out
    for j in range(i+1,big):
#        if '0' in str(j):          #commented out
#            continue             #commented out
        if i-j == pod(j) - pod(i):
            # print(i,j, pod(i), pod(j), ' ', j-i)
            sum1 = i+i+j
            sum2 = i+j+j
            if i+i+j == 2*(pod(i)+pod(i)+pod(j)):
                ans.append([i,i,j])
                print(i,j, pod(i), pod(j), ' ', j-i)
            if i+j+j == 2*(pod(i)+pod(j)+pod(j)):
                ans.append([i,j,j])
                print(i,j, pod(i), pod(j), ' ', j-i)
print(ans)

Edited on September 5, 2023, 10:54 am

Edited on September 6, 2023, 5:37 am
  Posted by Larry on 2023-09-05 10:52:53

Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (1)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (14)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information