We will be dealing with two-digit numbers non divisible by 11.
For each such number A there will exist another A’, a number created by inverting the digits of A so 45’=54, 87’=78.
Take for example 2 numbers 36 & 84: their product is the same as the product of those numbers inverted i.e. 63*48.
Find all the couples possessing such feature i.e. AB=(A')*(B').
Rem: to preserve conformity present the smallest number on the LHS of the equation - like 12*42=21*24.
Program finds 28 solutions (really 14 since RHS is always valid as a LHS) each is listed twice:
12*42 = 21*24
12*63 = 21*36
12*84 = 21*48
13*62 = 31*26
13*93 = 31*39
14*82 = 41*28
21*24 = 12*42
21*36 = 12*63
21*48 = 12*84
23*64 = 32*46
23*96 = 32*69
24*63 = 42*36
24*84 = 42*48
26*31 = 62*13
26*93 = 62*39
28*41 = 82*14
31*39 = 13*93
32*46 = 23*64
32*69 = 23*96
34*86 = 43*68
36*42 = 63*24
36*84 = 63*48
39*62 = 93*26
42*48 = 24*84
43*68 = 34*86
46*96 = 64*69
48*63 = 84*36
64*69 = 46*96
----------
for a in range(10,100):
if a%11 == 0:
continue
reva = int(str(a)[::-1])
for b in range(a+1,100):
if b%11 == 0:
continue
if b == a or b == reva:
continue
revb = int(str(b)[::-1])
if a*b == reva*revb:
print('{}*{} = {}*{}'.format(a,b, reva,revb) )
|
Posted by Larry
on 2024-05-24 00:36:55 |