first of all, to reverse binary and then convert back to decimal, u dont really need that many functions. all u need to do is this:
f(n)=total(mod(floor(n/2^{[k...0]}),2)2^{[0...k]})
k=floor(log_2(n+0^n))
f(n) takes in decimal, reverses binary, and converts back to decimal