shuijian-xu / bitcoin

0 stars 0 forks source link

why we choose to use finite fields with a prime number of elements? #135

Open shuijian-xu opened 4 years ago

shuijian-xu commented 4 years ago

No matter what k you choose, as long as it’s greater than 0, multiplying the entire set by k will result in the same set as you started with.

shuijian-xu commented 4 years ago

n**(p–1) is always 1 for every p that is prime and every n > 0. This is a beautiful result from number theory called Fermat’s little theorem. Essentially, the theorem says:

n**(p–1)%p = 1

where p is prime.