Questions tagged [modular-arithmetic]

Modular arithmetic (clock arithmetic) is a system of integer arithmetic based on the congruence relation $a \equiv b \pmod{n}$ which means that $n$ divides $a-b$.

Modular arithmetic (clock arithmetic) is a system of arithmetic of integers. The basic ingredient is the congruence relation $a \equiv b \bmod n$ which means that $n$ divides $a-b$. In modular arithmetic, one can add, subtract, multiply, and exponentiate but not divide in general. The Euclidean Algorithm, the Chinese Remainder Theorem, and Fermat's Little Theorem are important throughout mathematics. Modular exponentiation plays an important role in cryptography nowadays.

11320 questions
38
votes
4 answers

Why is n mod 0 undefined?

I tried to find out what $n$ mod $0$ is, for some $n\in \mathbb{Z}$. Apparently it is an undefined operation - why?
Newb
  • 17,672
  • 13
  • 67
  • 114
34
votes
3 answers

How can I find a mod with negative number?

I know how to solve mod using division i.e. $$11 \mod 7 = 4$$ For this I did a simple division and took its remainder: i.e. $$11 = 7 \cdot 1 + 4$$ Where $11$ was dividend, $7$ divisor, $1$ quotient and $4$ was remainder. But I have a problem…
29
votes
6 answers

Why do these days of the week line up?

I go to the gym every Mon/Wed/Fri while a friend of mine goes every 3 days regardless of the day. A typical two weeks could look like: Su | M | T | W | R | F | Sa | Su | M | T | W | R | F | Sa ME: X X X X X …
scohe001
  • 477
18
votes
4 answers

Modular Arithmetic - Find the Square Root

In my math notes it shows this example: Example: Compute the square root of $3 \pmod{143}$. We have $143=11\cdot 13$. (Then he jumps to this:) $$ \sqrt{3}\equiv \pm 5 \pmod{11} $$ $$ \sqrt{3}\equiv \pm 4 \pmod{13}. $$ Using the Chinese Remainder…
dunika
  • 433
17
votes
2 answers

Proving that modular inverse only exists when $\gcd(n,x)=1$

I'm having trouble understanding why for finding the inverse for $x\bmod n$, $\gcd(x, n)=1$ is a precondition. Obviously I've tried examples where the gcd is greater than one and I can't find $a$ for $ax \equiv _n 1$. I'm trying to prove to myself…
Carpetfizz
  • 1,133
16
votes
1 answer

Rules for algebra equations involving modulo operations

While working on a menial task in front of a clock today I was distracting myself by proving that all three hands only align twice a day. That lead me to wonder how one would deal with more complex problems involving modulo arithmetic. I know…
John F. Miller
  • 273
  • 1
  • 2
  • 6
16
votes
6 answers

How to calculate a Modulo?

I really can't get my head around this "modulo" thing. Can someone show me a general step-by-step procedure on how I would be able to find out the 5 modulo 10, or 10 modulo 5. Also, what does this mean: 1/17 = 113 modulo 120 ? Because when I…
Rymk
  • 213
15
votes
3 answers

Smallest cube ending in $2017$

What is the smallest cube ending in $2017$? My try: I know that the only possible units digit is $3$, $$(a+3)^3 = 2017 \mod 10^4\;$$ and $$a^3 + 9a^2 + 27a = 1990\mod 10^4$$ I don't know how to proceed, I tried factoring and adding $10^5$ and…
SuperMage1
  • 2,486
14
votes
4 answers

In mod3, is 3 greater than, or less than 1?

In modular arithmetic (say mod3), is the largest number (3) greater than or less than the smallest number? Because, intuitively, it would be greater, but 3+1=1 in mod3 which would suggest that it is smaller.
davecw
  • 243
10
votes
2 answers

Very simple question, but what is the proof that x.y mod m == ((x mod m).y) mod m?

I apologise for this question, as it is no doubt very simple, but I've never been very confident with proofs. Our lecturer today (in a course related to maths but not mathematical itself) was playing with doing the modulus of powers, and used the…
Andrew
10
votes
2 answers

Modular congruence not adding up

I am having trouble actually really understanding the modulo congruence. I understand it intuitively very well. However, I fear that my background in development is not helping. Writing: $x \equiv y \pmod m$ Means that both $X$ and $Y$ belong have…
Merc
  • 213
9
votes
3 answers

Changing modulus in modular arithmetic

Is it true that $$a\equiv b\pmod{m}\implies\frac{a}{n}\equiv\frac{b}{n} \pmod{\frac{m}{n}},$$ where $a, b, m, n, \frac{a}{n}, \frac{b}{n}, \frac{m}{n}\in\mathbb{N}$? If so, how do I prove it?
9
votes
6 answers

Why is $-145 \mod 63 = 44$?

When I enter $-145 \mod 63$ into google and some other calculators, I get $44$. But when I try to calculate it by hand I get that $-145/63$ is $-2$ with a remainder of $-19$. This makes sense to me, because $63\cdot (-2) = -126$, and $-126 - 19 =…
9
votes
2 answers

What are the properties of the modulus

Is the modulus $\%$ commutative, associative, or etc? For example, can I do this: Here is an equation I'm using: $$h_1 = (a \cdot a \cdot c_1 + a \cdot c_2 + c_3) \bmod a$$ I put aside the modulus, so I can easily rearrange the equation: $$a \cdot…
user52343
  • 195
8
votes
1 answer

Find the inverse modulo of a number - got a negative result

I'm trying to find the inverse modulo of $17\pmod{3120}$ I've tried: $$ \begin{eqnarray} 3120 =& 17\cdot 183 &+ 9\\ 17 =& 9\cdot 1 &+ 8\\ 9 =& 8\cdot 1 &+ 1\\ 8 =& 8\cdot1 \end{eqnarray} $$ and then do it from the the…
Chin
  • 323
  • 2
  • 6
  • 15
1
2 3
99 100