Fractional Modular Arithmetic

I am stuck with this cryptography issue using integer multiplication and mod 10 fraction.

Here is the equation:

7 * (4/11) mod 10 =?

I know that I have to convert this to an integer since the mod statement does not work with fractions, but I cannot figure it out. It's obvious that

7 * (4/11) = 28/11,

but i can't get mod 10 fractions. The instructor wants an exact answer, not a decimal place. Any help would be greatly appreciated!

+5
source share
6 answers

8

8 is really the right answer.

7*4/11 mod 10means that we look at 7*4*x mod 10where x is modular, inverse to 11 modulo 10, which means that 11*x mod 10 = 1. This is true for x=1( 11*1 mod 10 = 1)

So 7*4*x mod 10 7*4*1 mod 10, 28 mod 10 = 8

+4

: " " math.stackexchange.com.

a (mod b) = a - b ⌊a/b⌋

⌊⋅⌋ . " " , , .

1/2 (mod3) = 1/2.

, a = 7 * (4/11) = 28/11 b = 10.

a/b= (28/11)/10 = 0,25454545...

⌊a/b⌋= 0

b ⌊a/b⌋= 0 * 0 = 0

a - b ⌊a/b⌋= 28/11 - 0 = 28/11

, 28/11.

28/11 . , , 2.54545454.....

- , .

+4

, mod 10 . (11 mod 1) 1, (7 * 4) mod 10 = 8.

.

, , , 28/11 - , , . , mod 2 ^ 256 .

+1

, , , . (mod 10) , , mod 10.

\ sqrt {foo}

, 10 , . , , 1/2 mod 10 , 2 10 .

\ sqrt {foo}

+1

, . , :

    7  4/11 mod 10 = ((7  4) mod 10)(11−1 mod 10) mod 10
    = (28 mod 10)(1 mod 10) mod 10
    = (8)(1) mod 10
    = 8 mod 10
+1

Python:

from fractions import Fraction
from math import fmod

print (fmod(Fraction(28, 11), 10))

2.545454545454. , 8 .

0

Source: https://habr.com/ru/post/1606106/


All Articles