# Find all positive integers solutions such that $3^k$ divides $2^n-1$

How can I find all positive of $k$ and $n$ such that $$\frac {2^n-1}{3^k}$$ is an integer? I know that $$2^n-1\equiv 0\pmod 3$$ If $n=2p$ with $p$ integer , $$2^n-1\equiv 0\pmod 9$$ If $n=6p$, $$2^n-1\equiv 0\pmod {27}$$ if $n=18p$, and continuing I can find all solutions but is there a general formula?

• The obvious pattern so far is that the coefficient of $p$ is multiplied by $3$ each time. – Arthur Jun 3 '15 at 18:58

Let $\, \upsilon_p(n)\,$ satisfy $\, p^{\upsilon_p(n)}\mid n\,$ and $\, p^{\upsilon_p(n)+1}\nmid n$.

$a\equiv b\not\equiv 0\pmod{\! p}$,$\ p$ odd prime $\,\Rightarrow\ \upsilon_p(a^n-b^n)=\upsilon_p(a-b)+\upsilon_p(n)$

$3\mid 2^n-1\,\Rightarrow\ n=2m$ for some $m\in\Bbb Z^+$

$\upsilon_3(4^m-1^m)=\upsilon_3(4-1)+\upsilon_3(m)=1+\upsilon_3(m)$

Solutions: $(k,n)=(x,2m)$ for any $x,m\in\Bbb Z^+$ with $x\le 1+\upsilon_3 (m)$.

• Thanks I wanted to use this theorem but I didn't note a stupid thing therefore I proved to solve in another way – Domenico Vuono Jun 3 '15 at 19:07