View Single Post
Old 2021-09-18, 23:44   #2
Mar 2021

548 Posts

Since i posted something not so useful,i thought i'd share something interesting ( nothing new, just something old and interesting):

If you run any mersenne number in the following equation, you will always get a bin of repeating 1's and 0's.
In [2521]: bin((2**107-1)*((2**107-1)//3)-1)                                                                                                                                                   
Out[2521]: '0b101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100110101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101'
Hang on my math is wrong, i know i'm just missing something simple, because:
In [2566]: p2ecm(8776024305713098891493168973639202693241257950045759271192581461)                                                                                                             
Out[2566]: [643, 84115747449047881488635567801, 162259276829213363391578010288127]

162259276829213363391578010288127//3+1 = 643 * 84115747449047881488635567801

In [2567]: bin(8776024305713098891493168973639202693241257950045759271192581461)                                                                                                               
Out[2567]: '0b101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101'
but i'll update it later, i confused myself and have been working on math problems all day so a little brain dead.

Ok HERE we go:
In [1615]: bin((2**107-1)*((2**107-1)//3+1))                                                                                                                                                          
Out[1615]: '0b101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101'
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:
a = 2**61-1  # 2305843009213693951 
z = a + a 
z = int(str(z),16) 
h = (int(str(a), 16) + int(str(a), 16))

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.

Last fiddled with by retina on 2021-09-19 at 05:36 Reason: Long lines are long
LarsNet is offline   Reply With Quote