# How do you take the multiplicative inverse of a p-adic number?

I am reading the wiki page for p-adic numbers and it states that they are a field extension of the rationals so each member has to have a modular multiplicative inverse. So how would I take the inverse of, say, 35 in the ring of 2-adic numbers?

-
To understand the $2$-adics better, first try finding the multiplicative inverse of $-7$. Note that $7=1-8$, and use the geometric series. – g.castro Dec 3 '12 at 17:30
Long division... – GEdgar Dec 3 '12 at 18:35

Long division. $1$ divided by $35$. First, $35$ base $2$ is $100011.$ So the problem is:

Look at the right-most digits. $1$ goes into $1$ how many times? $1$:

Multiply:

Subtract:

Next digit is $1$, so $1$ goes in the quotient:

Multiply:

Subtract:

Next digit is zero, $0$ goes in the quotient. Next digit is $1$. Multiply:

Subtract:

Three zeros, then a 1:

Continue. It is eventually periodic, of course.

-

Following @RobertIsrael, I say: $35=1+34$. Using the geometric series for $1/(1+x)$, $$1/35=1-34+34^2-34^3+\cdots\,,$$ a $2$-adically convergent series.

-

Another way: note that $2^{12} \equiv 1 \text{ mod }35$. Now $(2^{12} - 1)/35 = 117 = 1 + 2^2 + 2^4+2^5+2^6$ so $$\dfrac{1}{35} = -\frac{117}{1-2^{12}} = - \sum_{j=0}^\infty\sum_{k \in \{0,2,4,5,6\}} 2^{12 j+k} = 1 + \sum_{j=0}^\infty\sum_{k \in \{1,3,7,8,9,10,11\}} 2^{12j+k}$$

-

With Mathematica, the following command will provide you an answer for 20 digits :

BaseForm[PowerMod[35, -1, 2^20], 2]

= 10001010111110001011 (base 2)

-