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!
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)
7*4/11 mod 10
7*4*x mod 10
11*x mod 10 = 1
x=1
11*1 mod 10 = 1
So 7*4*x mod 10 7*4*1 mod 10, 28 mod 10 = 8
7*4*1 mod 10
28 mod 10 = 8
: " " math.stackexchange.com.
a (mod b) = a - b ⌊a/b⌋⌊⋅⌋ . " " , , .1/2 (mod3) = 1/2.
a (mod b) = a - b ⌊a/b⌋
⌊⋅⌋ . " " , , .
1/2 (mod3) = 1/2.
, a = 7 * (4/11) = 28/11 b = 10.
a = 7 * (4/11) = 28/11
b = 10
a/b= (28/11)/10 = 0,25454545...
a/b
⌊a/b⌋= 0
⌊a/b⌋
b ⌊a/b⌋= 0 * 0 = 0
b ⌊a/b⌋
a - b ⌊a/b⌋= 28/11 - 0 = 28/11
a - b ⌊a/b⌋
, 28/11.
28/11 . , , 2.54545454.....
28/11
- , .
, mod 10 . (11 mod 1) 1, (7 * 4) mod 10 = 8.
.
, , , 28/11 - , , . , mod 2 ^ 256 .
, , , . (mod 10) , , mod 10.
(mod 10)
mod 10
, 10 , . , , 1/2 mod 10 , 2 10 .
1/2 mod 10
, . , :
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
Python:
from fractions import Fraction from math import fmod print (fmod(Fraction(28, 11), 10))
2.545454545454. , 8 .
Source: https://habr.com/ru/post/1606106/More articles:Correct message url for GCM device? - androidVisual Studio 2015 sometimes freezes when deploying a Xamarin application on a device - c #Материальный дизайн Lite проблемы с разрешением Angular JS - angularjsphantomjs - css transform rotate - javascriptHow to trigger a check for a button click event that is not a send type, but a button type without a form? - jqueryTravisCI fails in my build when tests fail - javascriptMove console window relative to screen - c #Erlang Pattern Match Error? - erlanghttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1606110/automatically-upload-assets-to-s3-without-assetssync&usg=ALkJrhj55wOZzkvcBKdx_jc4agMDqKSS3gКак инициализировать массив строк для многопроцессорности - pythonAll Articles