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

Home > Numbers
Unknown Digits (Posted on 2004-08-11) Difficulty: 4 of 5
In this cryptarithm, each letter above the line represents a digit differing by 1 from the digit represented by the same letter below the line. For example, if A=3 above the line, then A=2 or A=4 below the line. All occurrences of a letter on the same side of a line represent the same digit. It is also known that there are total of five digits in the solution.
 ADABA
+CACBA
------
 DBABC

See The Solution Submitted by Brian Smith    
Rating: 3.6667 (3 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Better late than never Comment 9 of 9 |
   56505
+ 15105
----------
   71610

Instead of calling the sum DBABC, I called it EFGHI and then let E be limited to D +/- 1, F be limited to B +/- 1 etc.

count = 0
for A in range(1,10):
    for B in range(0,10):
        if A==B:
            continue
        for C in range(1,10):
            if A==C or B==C:
                continue
            for D in range(0,10):
                if A==D or B==D or C==D:
                    continue
                ADABA = 10000*A+1000*D+100*A+10*B+A
                CACBA = 10000*C+1000*A+100*C+10*B+A
                n = ADABA+CACBA
               
                for E in range(D-1,D+2,2):
                    for F in range(B-1,B+2,2):
                        for G in range(A-1,A+2,2):
                            for H in range(B-1,B+2,2):
                                for I in range(C-1,C+2,2):
                                    DBABC = 10000*E + 1000*F+100*G+ 10*H + I
                                    if n == DBABC:
                                        count += 1
                                        print(ADABA, CACBA, n, DBABC)
                                   
print('done', count)
---
Output:
56505 15105 71610 71610
done 1

  Posted by Larry on 2019-11-18 20:32:56
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 (17)
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