Find all positive integers (a,b,c) such that
ab-c, bc-a, ca-b are all powers of 2.
wlog, assume a ≤ b ≤ c
(a,b,c) --> the powers of 2
(2,2,2) --> (2,2,2)
(2,2,3) --> (1,4,4)
(2,6,11) --> (1,64,16)
(3,5,7) --> (8,32,16)
"""
import math
big = 1000
top = 1 + int(math.log(big**2,2))
pow2s = [2**i for i in range(top+1)]
for a in range(1,big+1):
for b in range(a,big+1):
for c in range(b,big+1):
if a*b-c not in pow2s:
continue
if b*c-a not in pow2s:
continue
if c*a-b not in pow2s:
continue
print('({},{},{}) --> ({},{},{})'.format(a,b,c,a*b-c,b*c-a,c*a-b))
|
Posted by Larry
on 2025-03-16 10:43:52 |