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} +$$