When given a number $k$ in the form $2^a \cdot 3^b$ with integers $a,b$ , I want to use a function $f(k)$ to retrieve $a$ and a function $g(k)$ to retrieve $b$.
I know that prime factorization can help but I want to try avoid algorithmic approaches. I tried taking $\log_2 k$ and $\log_3 k$, but was unsuccessful in manipulating the results to isolate $a$ or $b$.
$$\log_2 k = a + b \log_2 3,$$
$$\log_3 k = b + a \log_3 2.$$
Thanks
I'm not sure how to interpret the question since ultimately anything you write down in math is going to correspond to some kind of algorithm. That being said, here's one way to try to do it which you can use in programs such as Desmos.
We know that $2^a \le k$ so we can round $k$ down to the nearest power of $2$ and write:
$$2^a = \gcd(k,2^{\lfloor \log_2(k)\rfloor})$$
In other words we have,
$$a = \log_2(\gcd(k,2^{\lfloor \log_2(k)\rfloor}))$$
Of course this is completely general for positive integers, so we can write the p power dividing $k$, called the p-adic valuation $v_p(k)$ as,
$$v_p(k) = \log_p(\gcd(k,p^{\lfloor \log_p(k)\rfloor}))$$
Here's a corresponding example in desmos to demonstrate.