Math Playgrounds
Interactive tools to explore and discover mathematical concepts through hands-on experimentation
Welcome to the Math Playgrounds! These interactive tools let you experiment with mathematical concepts, see patterns emerge, and discover relationships through exploration. Each playground is designed to help you understand the "why" behind the math, not just the "what".
Caesar Cipher Encryptor
Build it first! Encrypt messages by shifting each letter. This is Day 1-2 of the Encryption Project. Try "HELLO" with shift 3 to get "KHOOR"!
Caesar Cipher Encryptor
Encrypt text by shifting each letter. Try "HELLO" with shift 3 to get "KHOOR"!
Alphabet Wheel (Shift = 3)
Each letter shifts 3 positions forward
Step-by-Step Encryption
KHOOR
💡 Try these examples:
Affine Cipher Encryptor/Decryptor
Week 2: Affine Cipher (Harder). Use formula (ax + b) mod 26. Key requirement: gcd(a, 26) = 1.
Affine Cipher Encryptor/Decryptor
Encrypt using formula: (ax + b) mod 26. Key requirement: gcd(a, 26) = 1
Step-by-Step Encryption
RCLLA
HELLO
Decrypt formula: (y - 8) × 21 mod 26
💡 Valid values for a (gcd(a, 26) = 1):
Mini-RSA Encryption/Decryption
Week 3: Mini-RSA. Use RSA with small numbers. Choose two primes p and q, then encrypt/decrypt messages.
Mini-RSA Encryption/Decryption
RSA encryption with small numbers. Choose two primes p and q, then select public key e.
Encryption Steps
Decryption Steps
855
123
✓ Successfully decrypted! Original message recovered.
🔒 Security Note:
This uses small numbers for learning. Real RSA uses primes with hundreds of digits. The security comes from the difficulty of factoring n = p × q when p and q are very large.
Divisibility Rules Tester
Week 1: Divisibility Rules. Test numbers against divisibility rules and find missing digits.
Divisibility Rules Tester
Test numbers against divisibility rules. Learn why each rule works!
4572 is divisible by 9
Sum of digits (18) is divisible by 9
1. Sum of digits: 4 + 5 + 7 + 2 = 18
2. 18 is divisible by 9
Find Missing Digit Problem
The number 45_72 is divisible by 9. What is the missing digit?
Check Digit Validator
Week 2: Check Digits (Real-World). Validate credit cards (Luhn Algorithm) and ISBN numbers.
Check Digit Validator
Validate credit cards (Luhn Algorithm) and ISBN numbers. Learn how check digits work!
Enter 15 digits (we'll calculate the 16th check digit)
Check Digit: 8
Complete number: 4532148803436468
Starting with: 453214880343646
Position 15 (from right): 6 (unchanged)
Position 14 (from right): 4 × 2 = 8
Position 13 (from right): 6 (unchanged)
Position 12 (from right): 3 × 2 = 6
Position 11 (from right): 4 (unchanged)
Position 10 (from right): 3 × 2 = 6
Position 9 (from right): 0 (unchanged)
Position 8 (from right): 8 × 2 = 16 → 16 - 9 = 7
Position 7 (from right): 8 (unchanged)
Position 6 (from right): 4 × 2 = 8
Position 5 (from right): 1 (unchanged)
Position 4 (from right): 2 × 2 = 4
Position 3 (from right): 3 (unchanged)
Position 2 (from right): 5 × 2 = 10 → 10 - 9 = 1
Position 1 (from right): 4 (unchanged)
After doubling: 413418870646686
Sum: 4 + 1 + 3 + 4 + 1 + 8 + 8 + 7 + 0 + 6 + 4 + 6 + 6 + 8 + 6 = 72
Check digit: (10 - 2) mod 10 = 8
Validation: 72 mod 10 = 2 → Invalid
💡 Try these examples:
Sieve of Eratosthenes
Week 1: Finding Primes. Watch the Sieve of Eratosthenes mark composite numbers and reveal primes!
Sieve of Eratosthenes
Find all prime numbers up to a given range. Watch as composite numbers are marked!
💡 How it works:
- 1. Start with 2 (first prime)
- 2. Mark all multiples of 2 as composite
- 3. Move to next unmarked number (3)
- 4. Mark all its multiples as composite
- 5. Repeat until you've checked up to √n
- 6. All remaining unmarked numbers are prime!
Primality Testing
Week 2: Testing Large Primes. Use Fermat's test and Miller-Rabin test to check if large numbers are prime.
Primality Testing
Test large numbers for primality using Fermat's test or Miller-Rabin test.
561 is probably prime
Actual result: Composite⚠️ Test was wrong!
Testing if 561 is prime using Fermat's Little Theorem
Base: 2
Fermat's Little Theorem: If 561 is prime, then 2^560 ≡ 1 (mod 561)
Calculate: 2^560 mod 561
Result: 1
1 = 1 → Probably prime
⚠️ Warning: 561 is a Carmichael number! Fermat's test can be fooled.
💡 Try these examples:
📚 Notes:
- • Fermat's test can be fooled by Carmichael numbers (like 561)
- • Miller-Rabin is more reliable and used in real cryptography
- • For large numbers, run multiple tests with different bases
Prime Patterns Explorer
Week 3: Prime Patterns. Explore twin primes and prime gaps. Discover unsolved mysteries!
Prime Patterns Explorer
Explore fascinating patterns in prime numbers: twin primes and prime gaps.
🔬 Unsolved Problem:
Are there infinitely many twin primes? This is one of the most famous unsolved problems in mathematics!
Emergency 1-Day Crash Course
Quick visualizations for the 4-hour crash course. Master the essentials!
Hour 1: Modular Arithmetic Basics
Clock arithmetic: 15 mod 12 = 3, 23 mod 7 = 2. Practice 20 problems.
Result
23 mod 7 = 2
Calculation Steps:
1. Divide 23 by 7
2. 23 = 3 × 7 + 2
3. Remainder: 2
∴ 23 mod 7 = 2
💡 Try exploring:
- • Try negative numbers: -5 mod 12
- • Try large numbers: 100 mod 7
- • Change the modulus and see how the clock changes
- • Notice patterns: (a + b) mod m = ((a mod m) + (b mod m)) mod m
Hour 2: GCD and Euclidean Algorithm
Learn gcd(48, 18) step-by-step. Practice 10 problems.
GCD Calculator (Euclidean Algorithm)
Find the Greatest Common Divisor using the Euclidean Algorithm. Learn step-by-step!
gcd(48, 18) = 6
Euclidean Algorithm Steps
Divide 48 by 18: quotient = 2, remainder = 12
Divide 18 by 12: quotient = 1, remainder = 6
Divide 12 by 6: quotient = 2, remainder = 0
✓ Remainder is 0! GCD = 6
Why This Works
The key insight: gcd(a, b) = gcd(b, a mod b)
If d divides both a and b, then d also divides (a mod b). So we can replace a with b and b with (a mod b), making the numbers smaller each step until we reach 0.
💡 Try these examples:
Hour 3: Modular Inverses
Find x where (5x) mod 26 = 1 using Extended Euclidean Algorithm. Practice 10 problems.
Modular Inverse Calculator
Find the modular inverse using Extended Euclidean Algorithm. The inverse of a mod m is the number x such that (a × x) mod m = 1.
gcd(5, 26) = 1
✓ gcd = 1, so inverse exists!
5-1 mod 26 = 21
Verification: (5 × 21) mod 26 = 1
Extended Euclidean Algorithm Steps
Find gcd(5, 26) and coefficients x, y such that 5x + 26y = gcd(5, 26)
Initial: r₀ = 5, r₁ = 26, s₀ = 1, s₁ = 0, t₀ = 0, t₁ = 1
Step 1:
q = ⌊5 / 26⌋ = 0
r₂ = 5 - 0 × 26 = 5
s₂ = 1 - 0 × 0 = 1
t₂ = 0 - 0 × 1 = 0
Step 2:
q = ⌊26 / 5⌋ = 5
r₂ = 26 - 5 × 5 = 1
s₂ = 0 - 5 × 1 = -5
t₂ = 1 - 5 × 0 = 1
Step 3:
q = ⌊5 / 1⌋ = 5
r₂ = 5 - 5 × 1 = 0
s₂ = 1 - 5 × -5 = 26
t₂ = 0 - 5 × 1 = -5
Final: gcd(5, 26) = 1
Coefficients: 5 × -5 + 26 × 1 = 1
From Extended Euclidean Algorithm:
5 × -5 + 26 × 1 = 1
So: 5 × -5 ≡ 1 (mod 26)
Therefore: 5-1 mod 26 = -5 mod 26 = 21
💡 Try these examples:
More Playgrounds Coming Soon
Prime Factorization
Interactive prime factorization with tree visualization.
Coming soon