Abner challenges Benny to find out his secret number. On being requested by Benny for some clues, Abner says:
- It is a 4-digit number.
- The thousands digit is precisely 5 less than one-sixth of the number formed by the concatenation of its hundreds and tens digit (from left to right).
- The hundreds digit is precisely 1.8 more than 1/40 of the number formed by the concatenation of its tens and units digits (from left to right).
- Its tens digit is precisely 2 less than 5/4 times the units digit.
Determine Abner's secret number from the above-mentioned statements.
Refer to the clues as 1,2,3,4.
From clue 3: CD/40 ends in .2 so CD is either 08, 48, 88; D = 8
From clue 3: B = 1.8 + CD/40 which makes B: {2,3,4} for C values of {0,4,8}
From clue 4: C = 8 therefore BCD is 488
From clue 2: 6 divides BC, with BC=48; so A = 8 - 5 = 3
ABCD is 3488
---------
for a in range(10):
for b in range(10):
for c in range(10):
for d in range(10):
bc = int(str(b)+str(c))
cd = int(str(c)+str(d))
if a + 5 == bc/6:
if b - 1.8 == cd/40:
if c + 2 == 5*d/4:
print(a,b,c,d)
|
Posted by Larry
on 2023-04-07 08:02:23 |