Math 2.0

definition

Modulo operation

Definition

Let aa and nn be integers with n≠0n \neq 0. The integer a mod na \bmod n is the remainder rr of the division of aa by nn. Thus a mod na \bmod n is the unique integer rr such that 0≤r<∣n∣0 \le r < |n| and a−ra - r is a multiple of nn.

Remarks

For example, 17 mod 5=217 \bmod 5 = 2 and (−17) mod 5=3(-17) \bmod 5 = 3. Many programming languages use a different convention. In them, the remainder has the sign of aa, so the result for −17-17 and 55 is −2-2. The Lean library Mathlib sets a mod 0=aa \bmod 0 = a.

Explanations

L1 human

The value a mod na \bmod n is what is left after you take away from aa as many copies of nn as you can. A clock uses this operation: 1515 hours after 00 o'clock, a 1212-hour clock shows 15 mod 12=315 \bmod 12 = 3.

What this node needs for W2
  • edge instance_of in: one example (0 of 1)
  • edge not_instance_of in: one non-example that fails one clause (0 of 1)

The writing levels say how complete the text of a node is. They do not measure its truth.

What this needs

To read this node, read these 3 nodes in this order. The foundations come first, and the list ends with this node.

Each node uses the nodes above it. The colour of the bar on a box shows the evidence level, and the box also gives it as text. The list below has the same nodes.
  • no evidence level
  1. Divisibility definition
  2. Division algorithm statement
  3. Modulo operation definition

Sources

  1. Web https://en.wikipedia.org/wiki/Modulo, Variants of the definition