Day 4: Modular Arithmetic & Groups
Note: today’s Replit includes solutions for the previous day’s required problems.
Lecture Topics
- notes
- remainders
- modular arithmetic
- commutative groups
- cyclic groups
Problems
Reminders:
- You can run tests for a function by running
python main.py FUNCTION_NAME
from the shell.
We’ll be working in the main.py
file. The hashing.py
file contains
solutions to yesterday’s required problems.
Some of the problems have written solutions rather than code. Put your solutions in a comment.
-
required:
- In the
IntMod
class:__add__
: gives Python’s+
operator__mul__
: gives Python’s*
operator__neg__
: gives Python’s unary-
operator__truediv__
: gives Python’s/
operator__pow__
: gives Python’s**
operator
order_2_element
- WQ1: power order
- WQ2: orders in $\mathbb{Z}_{11}^*$
- WQ3: order patterns
discrete_log_7
- In the
-
bonus:
- WQ4: roots
my_pow