Keeping track of various interesting 2-adic integers.

See Visualizing the computation of 2-adic integers

See How I would do FizzBuzz

Inspired by 2-adic Logarithms and Fast Exponentiation

1 Billion is Tiny in an Alternate Universe (Intro to p-adic Numbers)

Two’s Complement and Group Theory

constants

4 = 0x0000000000000004 = 0b0000000000000000000000000000000000000000000000000000000000000100

5 = 0x0000000000000005 = 0b0000000000000000000000000000000000000000000000000000000000000101

8 = 0x0000000000000008 = 0b0000000000000000000000000000000000000000000000000000000000001000

9 = 0x0000000000000009 = 0b0000000000000000000000000000000000000000000000000000000000001001

12 = 0x000000000000000c = 0b0000000000000000000000000000000000000000000000000000000000001100

13 = 0x000000000000000d = 0b0000000000000000000000000000000000000000000000000000000000001101

17 = 0x0000000000000011 = 0b0000000000000000000000000000000000000000000000000000000000010001

25 = 0x0000000000000019 = 0b0000000000000000000000000000000000000000000000000000000000011001

33 = 0x0000000000000021 = 0b0000000000000000000000000000000000000000000000000000000000100001

reciprocal

signature: 1 -> 1

1/3 %% 64 = 12297829382473034411 = 0xaaaaaaaaaaaaaaab = 0b1010101010101010101010101010101010101010101010101010101010101011

1/5 %% 64 = 14757395258967641293 = 0xcccccccccccccccd = 0b1100110011001100110011001100110011001100110011001100110011001101

1/15 %% 64 = 17216961135462248175 = 0xeeeeeeeeeeeeeeef = 0b1110111011101110111011101110111011101110111011101110111011101111

log

signature: 01 -> 00

Using Taylor series of log(1 + x)

log(5) %% 64 = 6713115954038056572 = 0x5d29c7648072267c = 0b0101110100101001110001110110010010000000011100100010011001111100

log(9) %% 64 = 6165135171829223912 = 0x558ef5c64525d1e8 = 0b0101010110001110111101011100011001000101001001011101000111101000

log(13) %% 64 = 13787063416730014148 = 0xbf557d2169f9d1c4 = 0b1011111101010101011111010010000101101001111110011101000111000100

log(17) %% 64 = 6071351533721251728 = 0x5441c60d71fa6f90 = 0b0101010001000001110001100000110101110001111110100110111110010000

log(45) %% 64 = 12878251125867280484 = 0xb2b8bd2ac597f864 = 0b1011001010111000101111010010101011000101100101111111100001100100

Notice log(5) + log(9) == log(45).

exp

signature: 00 -> 01

exp(4) %% 64 = 16949889225439723853 = 0xeb3a1a72388e414d = 0b1110101100111010000110100111001000111000100011100100000101001101

exp(8) %% 64 = 4996840759179358505 = 0x4558583232143129 = 0b0100010101011000010110000011001000110010000101000011000100101001

exp(12) %% 64 = 5839345754024194645 = 0x510986066d4c3255 = 0b0101000100001001100001100000011001101101010011000011001001010101

sqrt (square root)

signature: 001(00){k} -> 1(0){k}

sqrt(9) %% 64 = 3 = 0x0000000000000003 = 0b0000000000000000000000000000000000000000000000000000000000000011

sqrt(9) %% 64 = 18446744073709551613 = 0xfffffffffffffffd = 0b1111111111111111111111111111111111111111111111111111111111111101

sqrt(17) %% 64 = 9629331466073876201 = 0x85a241f333d326e9 = 0b1000010110100010010000011111001100110011110100110010011011101001

sqrt(17) %% 64 = 8817412607635675415 = 0x7a5dbe0ccc2cd917 = 0b0111101001011101101111100000110011001100001011001101100100010111

sqrt(25) %% 64 = 5 = 0x0000000000000005 = 0b0000000000000000000000000000000000000000000000000000000000000101

sqrt(25) %% 64 = 18446744073709551611 = 0xfffffffffffffffb = 0b1111111111111111111111111111111111111111111111111111111111111011

sqrt(33) %% 64 = 12864872115374745489 = 0xb289350725bd6791 = 0b1011001010001001001101010000011100100101101111010110011110010001

sqrt(33) %% 64 = 5581871958334806127 = 0x4d76caf8da42986f = 0b0100110101110110110010101111100011011010010000101001100001101111

sqrt(-7) %% 64 = 1852311383259529397 = 0x19b4bb639c98c0b5 = 0b0001100110110100101110110110001110011100100110001100000010110101

sqrt(-7) %% 64 = 16594432690450022219 = 0xe64b449c63673f4b = 0b1110011001001011010001001001110001100011011001110011111101001011

cbrt (cube root)

signature: 1 -> 1

cbrt(3) %% 64 = 12826195997845746043 = 0xb1ffcd4dcf21f17b = 0b1011000111111111110011010100110111001111001000011111000101111011

cbrt(5) %% 64 = 4190031974729141853 = 0x3a25fbe19b424e5d = 0b0011101000100101111110111110000110011011010000100100111001011101

cbrt(7) %% 64 = 263977337666645399 = 0x03a9d5fd705fad97 = 0b0000001110101001110101011111110101110000010111111010110110010111