* * *
* *
---------
* * * *
* * * *
---------
* * * * *
In this cryptarithm both the digits and operations have been removed. Each digit is a prime (2, 3, 5, or 7). Give the correct arrangement of digits and the two operations.
First step: find possible values for xxx times x equals xxxx s.t. each digit is a prime.
So, don't solve the entire equation, just find a 3-digit number, a 1-digit number and a 4-digit number formed solely of those 4 digits.
It turns out there are only 4 possibilities:
325 * 7 = 2275,
555 * 5 = 2775,
755 * 5 = 3775,
775 * 3 = 2325
So the only possible arrangements for the first 2 lines:
325*77 = 25025 but 0 not prime
555*55 = 30525 but 0 not prime
755*55 = 41525 but 1,4 not prime
775*33 = 25575 <--- solution
The operators are '*' in front of the second line and '+' in front of the fourth line
7 7 5
* 3 3
---------
2 3 2 5
+ 2 3 2 5
---------
2 5 5 7 5
-------------------
baddigits = [str(i) for i in [0,1,4,6,8,9]]
possibles = []
for A in [2,3,5,7]:
for B in [2,3,5,7]:
for C in [2,3,5,7]:
for D in [2,3,5,7]:
three_digit_num = (100*A + 10*B + C)
multiplier = D
prod = three_digit_num*multiplier
if prod < 1000 or prod > 9999:
continue
strprod = str(prod)
fail = False
for s in strprod:
if s in baddigits:
fail = True
if fail:
continue
possibles.append([three_digit_num,multiplier,three_digit_num*multiplier])
print(possibles)
OUTPUT: [[325, 7, 2275], [555, 5, 2775], [755, 5, 3775], [775, 3, 2325]]
|
Posted by Larry
on 2025-02-19 13:26:23 |