1
$\begingroup$

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 > logChar : 
        precisionBits = logChar
        
    bitMap = int(math.pow(2, precisionBits + logMant))

    for i in range(precisionBits + 1, 0 , -1):
        if masks[i] & bitMap > 0:
            polynomial += "2^{" + str(logChar - precisionBits + i ) + "} +"
        
    if printNow <= 0:
        print("bin(nT): \t" + str(bin(nT)))
        print("bitMap - (nT >> (logChar - precisionBits)): \t" + str(bitMap - (nT >> (logChar - precisionBits))))
        print("logMant: \t" + str(logMant))
        print("bin(bitMap): \t" + str(bin(bitMap)))
        print("log: \t" + str(log))
        printNow = printFreq

    nT = nT - (bitMap << (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} +$$

$\endgroup$

1 Answer 1

1
$\begingroup$

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!!!

$\endgroup$
15
  • 1
    $\begingroup$ 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. $\endgroup$
    – juanmf
    Commented Jun 20, 2022 at 19:02
  • 1
    $\begingroup$ 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!!! $\endgroup$
    – user860474
    Commented Jun 20, 2022 at 19:08
  • 1
    $\begingroup$ 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$. $\endgroup$
    – juanmf
    Commented Jun 20, 2022 at 19:15
  • 1
    $\begingroup$ What's the $3^{n+1}$ conjecture? XD $\endgroup$
    – juanmf
    Commented Jun 20, 2022 at 19:16
  • 1
    $\begingroup$ You are correct, I'm not in the math world, I'm a software engineer, just like math. $\endgroup$
    – juanmf
    Commented Jun 20, 2022 at 19:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .