View Single Post
Old 2021-09-19, 14:08   #5
Dr Sardonicus
 
Dr Sardonicus's Avatar
 
Feb 2017
Nowhere

2×3×853 Posts
Default

Quote:
Originally Posted by LarsNet View Post
<snip>
And to create a hilo map (this is an original discovery as far as i know while studying primes )
meaning map 1 to 5 through 9 and 0 to 0 through 4, use this equation:
Code:
a = 2**61-1  # 2305843009213693951 
z = a + a 
z = int(str(z),16) 
h = (int(str(a), 16) + int(str(a), 16))
print(hex((z-h)//6)

2305843009213693951
0001100001000110110
The 0's align with 0-4 above the binary, and 1's align with 5-9 above the hex of (z-h)//6. The binary is in the hex, nice.
Congratulations. You've discovered that in the decimal addition a + a, there's a carry from places whose digits are greater than 4, and no carry from places whose digits are less than 5.
Dr Sardonicus is offline   Reply With Quote