P2L5.5: Modular Arithmetic Flashcards

1
Q

What is the formula for mod’ing a negative number?

A

A mod B
A = Q * B + R
Q = floor(A/B)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q
  • What is -6 mod 18?
A

A = Q * B + R
Q = floor(-6/18) ==> -(1/3) ==> -1 (round down!)
-6 = -1 * 18 + R

12 = R

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q
  • What is -17 mod 7?
A

A = Q * B + R
Q = floor(-17/7) ==> -(2.4) ==> -3 (round down!)
-17 = -3 * 7 + R

4 = R

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does the Property of Congruence say about…

A = B mod C

A

A mod C = B mod C

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the steps to calculate a Modular Inverse?

A

Step 1: Calculate A*B mod C for B equal to values 0 through (C-1)
Step 2: Modular inverse of A mod C is the B value that makes AB mod C = 1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Find the modular inverse of 8 mod 5.

A
  • Calculate A*B mod C for B equal to values 0 through C-1
    • 8*0 mod 5 = 0
    • 8*1 mod 5 = 3
    • 8*2 mod 5 = 1
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How do you tell if two numbers are relatively prime?

A

Their greatest common factor should be 1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Are 6 and 8 relatively prime?

A

No, because…
[1, 2, 3, 6] and [1, 2, 4, 8]
have 2 as their greatest/highest common factor.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Are 6 and 35 relatively prime?

A

Yes, because…
[1, 2, 3, 6] and [1, 5, 7, 35]
have 1 as their greatest/highest common factor.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How do you tell if a number is a prime root of another number?

A

If we are checking to see if A is a prime root of B, then take A and calculate…
A^0 mod B = W
A^1 mod B = X
A^2 mod B = Y
A^B-1 mod B = Z
If W through Z are all unique then A is a prime root of B.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Is 2 a prime root of 7?

A
YES, because...
* 2^1 mod 11 = 2
* 2^2 mod 11 = 4
* 2^3 mod 11 = 8
* 2^4 mod 11 = 5
* 2^5 mod 11 = 10
* 2^6 mod 11 = 9
* 2^7 mod 11 = 7
* 2^8 mod 11 = 3
* 2^9 mod 11 = 6
* 2^10 mod 11 = 1
All numbers are unique so 2 is a prime root of 11.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly