I'm trying to solve this system of equations for $a$: $$\frac{3n+1}{2^{a-1}} \mod 2 = 1$$ $$n \mod 2 = 1$$ for any odd input $n$.
I know that there is only $1$ solution for every possible $n$ value. For example, if $n=9$, then $a=3$, however, I am unable to solve algebraically for $n$. Is it possible to do so?
By definition if $x \mod 2 = 1$, then $x$ is odd.
If $n$ is guaranteed odd, then the second equation is guaranteed.
The numerator $3n + 1$ of the first equation is always positive and even. But after dividing by $2^{a-1}$ we want the output to be odd. Thus, this problem is in a way about prime factors. Think of the prime factorization:
$$3n + 1 = 2^{x} \cdot \prod_{i=1}^{b} p^{\, x_i}_{\,i}$$.
$x$ represents the number of $2$'s in the prime factorization of $3n + 1$. By definition of the primes greater than $2$, $p_{\, i}$ must be odd for every $i$. With this, we know
$$ \frac{3n+1}{2^{a-1}} = 2^{x - a + 1} \cdot \prod_{i=1}^{b} p^{\, x_i}_{\,i}$$
and this number can only be odd if $a = x + 1$ (if $a < x + 1$, there would be a $2$ left which makes it even, and if $a > x + 1$, the modulus would be a fraction).
This all being said, I don't think there is an analytical closed-form formula for the number of $2$'s in the prime factorization of a number.