モジュロ演算(剰余演算)

2017/6/28

Shinichiro Sakamoto

広告

mod pのpが素数のときは割り算も定義される。素数でないとき、二つの数のかけ算にならない剰余があるため、割り算は定義できない。

mod2

0 + 0 = 0
0 + 1 = 1
1 + 1 = 0

0 × 0 = 0
0 × 1 = 0
1 × 1 = 1

mod3

0 + 0 = 0
0 + 1 = 1
0 + 2 = 2
1 + 1 = 2
1 + 2 = 0
2 + 2 = 1

0 × 0 = 0
0 × 1 = 0
0 × 2 = 0
1 × 1 = 1
1 × 2 = 2
2 × 2 = 1

mod5

0 + 0 = 0
0 + 1 = 1
0 + 2 = 2
0 + 3 = 3
0 + 4 = 4
1 + 1 = 2
1 + 2 = 3
1 + 3 = 4
1 + 4 = 0
2 + 2 = 4
2 + 3 = 0
2 + 4 = 1
3 + 3 = 1
3 + 4 = 2
4 + 4 = 3

0 × 0 = 0
0 × 1 = 0
0 × 2 = 0
0 × 3 = 0
0 × 4 = 0
1 × 1 = 1
1 × 2 = 2
1 × 3 = 3
1 × 4 = 4
2 × 2 = 4
2 × 3 = 1
2 × 4 = 3
3 × 3 = 4
3 × 4 = 2
4 × 4 = 1

加筆中…


Warning: Invalid argument supplied for foreach() in /home/irohakasa/irohabook.com/public_html/wp-content/themes/child/single.php on line 125

広告

広告