Remainder of dividing $3^n$ by $2^n$.

195 Views Asked by At

I'd like to find the remainder of dividing $3^n$ by $2^n$, that is, I'd like to find value of $r$ in the expression $$3^n=q2^n+r,$$ where $q\in\mathbb{Z}$ and $0<r<2^n$.

I know that it can be $$r=3^n-2^n\left\lfloor\frac{3^n}{2^n}\right\rfloor$$ But it isn't nice. Can I do that without floor?

I thought I could find it by solving this $$\sum_{i=0}^{k}{n\choose i}2^i<2^n$$ where $k\le n$. It will work because $$3^n=(1+2)^n=\sum_{i=0}^n{n\choose i}2^i,$$ but I can't find the $k$ value.

1

There are 1 best solutions below

0
On BEST ANSWER

This sequence is given in the Online Encyclopedia of Integer Sequences:

https://oeis.org/A002380

There doesn't seem to be an explicit formula for it, and it appears to grow exponentially, but unevenly. Sometimes, it decreases, but in the long run, it roughly doubles each time $n$ increments by $1$, which is to say, when $n$ increases to $n+k$, we have $f(n)$ increasing by a ratio of roughly $2^k$, more apparent for larger $k$.