1

From the idea of sums of powers of 2 described in this question is very clear that we can form any natural $\Bbb N$ from a sum of powers of 2.

So what would be, the transformation from: $$a = m^n \to \sum_{i \in K}{2^i} = a | i,m,n \in \Bbb N; K = \{??\}$$

I can think of $\lfloor \log_{2}{(a)}\rfloor$ as the first $i_0$ exponent. Also can imagine the decimal part of $ \log_{2}{(a)} $ to contain all needed info to assemble the rest of the polynomial of bases 2:

$$f(a) = \{a\}=\log_{2}{(a)} - \lfloor \log_{2}{(a)}\rfloor \to \sum_{i \in \{K-i_0\}}{2^i} = b | 2^{i_0} + b = a$$

In other words, how to process (reverse engineer) the decimal part of $log$ to infer the missing exponents of the base?

$log$ or not $log$ based (this is just where I'd start thinking of it) is there way to map the two forms of calculating $a$?

Edit

My idea on how to use the Mantissa, was something like this:

resolution: 512..1024
1000000000  9
1000000001    <-    9.002815016
1000000010    <-    9.005624549
1000000011    <-    9.008428622
...
1000111000.   <-    9.14974712 <<
...
1111111100    <-    9.994353437
1111111101    <-    9.995767151
1111111110    <-    9.997179481
1111111111    <-    9.99859043
10000000000   <-    10

So this would yield the coefficients for the most significant bits. I could use a map or $f(a) = \{m^n\}=\log_{2}{(m^n)} - \lfloor \log_{2}{(m^n)}\rfloor$ and then my arbitrary resolution bit map will be the characterictic of choice...

So lets say $m^n = 25^8 = 152587890625$ and $\log_{2}{(m^n)} = \log_{2}{(m)} * n = 37.15084952$ My closest mapping above is $x.14974712 -> 1000111000 $

So $152,587,890,625 - (2^{37} + 2^{33} + 2^{32} + 2^{31}) = 116,551,617$

(But I could get more precise) Define $p$ as the number of bits/terms for the polynomial, for instance 31.

$$2^{p.15084952} = 0x10001110000110111100100111000001$$

$$\to (2^{37} + 2^{33} + 2^{32} + 2^{31} + 2^{26} + 2^{25} + 2^{23} + 2^{22}+ 2^{21}+ 2^{20}+ 2^{17}+ 2^{14}...+ 2^{6})$$

Then these should match bit by bit the most significant bits in $m^n$.

Repeat. Hopefully without having to compute $m^n$ but here it looks lie I need to do the subtraction to get $\log_2{(116,551,617)}$

Edit2

Due to precision, the idea seems impractical for big numbers and also can't avoid computing $ m^n - \sum$.

Wrote this POC you can test online: https://www.programiz.com/python-programming/online-compiler/


import math

#print(bin(1 << -1)) #print(bin(1 >> -1)) m = 25 n = 10 masks = [] for i in range(64): masks.append(1 << i)

log = 2 printFreq = 1 printNow = 1 nT = int(math.pow(m, n)) print(nT) precisionBits = 20 polynomial = "" while nT > 1: printNow -= 1 log = math.log2(nT) logChar = int(log) logMant = log - logChar

if precisionBits &gt; logChar : 
    precisionBits = logChar

bitMap = int(math.pow(2, precisionBits + logMant))

for i in range(precisionBits + 1, 0 , -1):
    if masks[i] &amp; bitMap &gt; 0:
        polynomial += &quot;2^{&quot; + str(logChar - precisionBits + i ) + &quot;} +&quot;

if printNow &lt;= 0:
    print(&quot;bin(nT): \t&quot; + str(bin(nT)))
    print(&quot;bitMap - (nT &gt;&gt; (logChar - precisionBits)): \t&quot; + str(bitMap - (nT &gt;&gt; (logChar - precisionBits))))
    print(&quot;logMant: \t&quot; + str(logMant))
    print(&quot;bin(bitMap): \t&quot; + str(bin(bitMap)))
    print(&quot;log: \t&quot; + str(log))
    printNow = printFreq

nT = nT - (bitMap &lt;&lt; (logChar - precisionBits))

print("$$ m^n \to \sum_{i \in K}{2^i} | " + str(m) + "^{" + str(n) + "} \to " + polynomial +"$$")

sample output is in Latex syntax: $$ m^n \to \sum_{i \in K}{2^i} | 25^{10} \to 2^{46} +2^{44} +2^{42} +2^{41} +2^{39} +2^{37} +2^{36} +2^{35} +2^{34} +2^{30} +2^{29} +2^{28} +2^{24} +2^{23} +2^{22} +2^{21} +2^{17} +2^{15} +2^{14} +2^{12} +2^{10} +2^{9} +2^{5} +$$

juanmf
  • 113

1 Answers1

1

Well, interesting you are basically trying to figure out indices $i$ in some $K$ such that $$m^{n}=\sum_{i\in K} 2^{i}$$ cool!!! So you are on the right track rather!!! So to figure this out you need to know $2^{k_{1}+1}<m^n<2^{k_{1}}$ so obviously some log base 2 and box function kill out $k_1$ now $2^{k_{2}+1}<m^{n}-2^{k_{1}}<2^{k_2}$ log out in base 2 $k_2$ proceed inductively until no such $k_{i}$ you could figure out!!!

  • 1
    Nice way of seeing it! One problem here is that I’m trying to avoid computing $m^n$ since for big integers it takes a long time. But your idea works. – juanmf Jun 20 '22 at 19:02
  • You don't need to compute m^n rather –  Jun 20 '22 at 19:04
  • 1
    You just need $log_{2}(m^n)$ then stuff like $m^n-log_{2}(m^n)$ as so on each time n got multiplied with log $m$ time complexity for this will be much lesser than actually producing pattern and guess after computing m^n but here we need log of it!!! , I hope there is such but if you figure out such pattern do tell me because it's highly related to 3n+1 conjecture!!! –  Jun 20 '22 at 19:08
  • 1
    Well, $\log_2{m^n} = (\log_2{m})*n$ so I'd not need to compute the former, only expensive computation here would be $\log_2{m}$. Then applying (haven't fully figured it out yet) your idea above, but using logs I guess we can avoid using powers altogether. since powers of 2 are just bit shifts. And $2^n$ is much slower than $2<<n$. – juanmf Jun 20 '22 at 19:15
  • 1
    What's the $3^{n+1}$ conjecture? XD – juanmf Jun 20 '22 at 19:16
  • 3n+1 conjecture means collatz conjecture !!!It's not on power though by the way 2^n grows way faster than n. –  Jun 20 '22 at 19:17
  • A Bhai ei gandu gulor fundamentals clear nai bole 2^n grows slower than n!!! COOL YOU ARE CORRECT!!! –  Jun 20 '22 at 19:20
  • Well, for what I understand, $a/2 \wedge 3a+1$ is just one example of Collatz idea, with powers of 2, you are forming the same number. could end in $2^0=1$ for odd numbers but for even numbers could be any exponent $ i > 0$ – juanmf Jun 20 '22 at 19:35
  • BTW A Bhai ei gandu gulor fundamentals clear nai bole kinda got lost with this, is that pure english? – juanmf Jun 20 '22 at 19:39
  • I got a see you know nothing!!! –  Jun 20 '22 at 19:42
  • 1
    You are correct, I'm not in the math world, I'm a software engineer, just like math. – juanmf Jun 20 '22 at 19:43
  • Keep Work on Yourself!!! Regards –  Jun 20 '22 at 19:43
  • 1
    I don't know who you are but keep learning for better and you will succeed , I cannot explain my idea about collatz because it's What I am currently working on but it hugely related to n-adic expansion!!!May be I don't understand your point's but it's okay right think me a foolish and be happy and I will think u will be a foolish so both happy!!! But keep working on Yourself !!! I hope you will be better than most of us but don't forget to help others Regards –  Jun 20 '22 at 19:49
  • 1
    Well, this is just hobby for me, work for big tech and spend most of my time on it. The general idea any number can be converted to 1, sounds like the prime numbers sieve I was working on (in reverse), as it starts with {1} and expands to all primes, which in turn are factors of all composites. Although it would not be 2 basic operations. https://mirror.xyz/0x62514E8C74B1B188dFCD76D2171c96EF1845Ba02/PhwGsMoDsGGfbagtxAhjM5OyvIPnFfF6dhBYb4QICfQ – juanmf Jun 20 '22 at 19:56
  • 1
    Just added my approach. A combination of yours and mine might be needed for bigIntegers larger than 64 bits. And or log precision loosing accuracy. Unless I can find $log_2(m^n - \sum{2^i})$ without computing $m^n$ it’s all for nothing. – juanmf Jun 21 '22 at 21:53