<p>Ok, I found later on the book...</p>
<p>Is about how to handle negative exponents using Fermat's little theorem.</p>
<p>a<sup>p-1</sup> = 1</p>
<p>so if <code>a = 17</code></p>
<p>17<sup>-3</sup> = 17<sup>-3</sup> * 1 = 17<sup>-3</sup> * 17<sup>p-1</sup> = 17<sup>p-4</sup></p>

CC BY-SA 4.0
2021-08-10T15:46:14.683Z
2021-08-11T13:09:41.160Z
2021-08-11T13:09:41.160Z
rubdottocom
<p>I guess this is a math question and not a bitcoin question, but I would have a hard time expressing the doubt in a math forum, whereas here, maybe someone who knows the book and has the right knowledge can answer me easily.</p>
<p>In chapter 1, exercise 8, where Finite Fields division is practiced, there is this exercise about the Finite Field: <code>F</code><sub><code>31</code></sub>:</p>
<p><em>17<sup>-3</sup></em></p>
<p>And the answer is:</p>
<p><em>pow(17, prime<sup>-4</sup>, prime)</em></p>
<p>I don't know why it is <code>prime</code><sup><code>-4</code></sup> instead of <code>prime</code><sup><code>-2</code></sup>, how is this decomposed?</p>
<p>Thanks!</p>

<math><programming-bitcoin-book>
Jimmy Song 'Programming Bitcoin' book math doubt
rubdottocom
# Jimmy Song 'Programming Bitcoin' book math doubt

(Asked by: username_0 on 2021-08-10)

I guess this is a math question and not a bitcoin question, but I would have a hard time expressing the doubt in a math forum, whereas here, maybe someone who knows the book and has the right knowledge can answer me easily.

In chapter 1, exercise 8, where Finite Fields division is practiced, there is this exercise about the Finite Field: `F``31`:

*17-3*

And the answer is:

*pow(17, prime-4, prime)*

I don't know why it is `prime``-4` instead of `prime``-2`, how is this decomposed?

Thanks!

**Tags:** math, programming-bitcoin-book


---

## 1 answers

### Answer by username_0 on 2021-08-10. Score: 4

Ok, I found later on the book...

Is about how to handle negative exponents using Fermat's little theorem.

ap-1 = 1

so if `a = 17`

17-3 = 17-3 \* 1 = 17-3 \* 17p-1 = 17p-4


---

