Example
Let n = 8 and p = 11
Then
0
mod(2, 11) = 1
1
mod(2, 11) = 2
2
mod(2, 11) = 4
3
mod(2, 11) = 8
4
mod(2, 11) = 5
5
mod(2, 11) = 10
6
mod(2, 11) = 9
7
mod(2, 11) = 7
This yields a table of the form
remainder bit position
0 --
1 0
2 1
3 --
4 2
5 4
6 --
7 7
8 3
9 6
10 5