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

Home > Just Math
Find All Numbers (Posted on 2006-07-25) Difficulty: 3 of 5
Find all four–digit numbers in which the product of the digits is equal to the sum of the digits, and the number itself is divisible by the sum of its digits.

No Solution Yet Submitted by Ravi Raja    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Solution (using computer) | Comment 1 of 8
Or rather, no solution, except for the trivial 0000 (which might not be considered a true four-digit number).

I used the following prolog code:

sol([A,B,C,D]) :-
        List = [1,2,3,4,5,6,7,8,9],
        member(A,List),
        member(B,List),
        member(C,List),
        member(D,List),
        Prod is A*B*C*D,
        Sum is A+B+C+D,
        Prod = Sum,
        Number is A*1000+B*100+C*10+D,
        modulo(Sum,Number,Mod),
        Mod = 0.

modulo(N,M,N) :-
        N < M,
        !.
modulo(N,M,Res) :-
        NN is N-M,
        modulo(NN,M,Res).

With the following result:

?- sol(L).

No

  Posted by Robby Goetschalckx on 2006-07-25 11:33:30
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 (10)
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