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

Home > Numbers
Find all Numbers II (Posted on 2022-04-24) Difficulty: 3 of 5
Determine all possible value(s) of a non-leading zero, 5-digit positive integer N that satisfy each of these given conditions:
(i) Product of the digits of N is equal to the sum of its digits.
(ii) N is divisible by the sum of its digits.
(iii) N does NOT contain the digit 3.

Added for completeness:
What is the total number of values of N if we disregard condition (iii)?

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.)
Solution Solution | Comment 2 of 4 |
The only 5-digit number meeting all criteria is 22112.
Somewhat interestingly, only one number with fewer than 5 digits meets the other criteria:  it is 4112

If condition (iii) is removed, then there are 11 solutions.  The other 10 solutions
are the combinations of any 5-digit number composed of three 1's and two 3's.

11133
11313
11331
13113
13131
13311
22112
31113
31131
31311
33111


---------   Python code   ---------
def sod(n):
    """ Input an integer.  Returns the Sum of the Digits  """
    aList = list(str(n))
    ans = 0
    for c in aList:
        ans = ans + int(c)
    return ans

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
count = 0
power = 4
for n in range(10**power,10**(power+1)):
    s = sod(n)
    if s  != pod(n):
        continue
    if n%s != 0:
        continue
    # if '3' in str(n):
    #     continue
    count += 1
    print(n)
print(count)

  Posted by Larry on 2022-04-24 09:52:46
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (12)
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