Welcome to Number Theory Based Algorithms — a comprehensive, hands-on collection of essential and advanced Number Theory algorithms implemented in both Java and Python.
This repository is designed for competitive programmers, math enthusiasts, and algorithmic learners who wish to deeply understand and efficiently implement number-theoretic techniques.
All algorithms here are explained in detail on my YouTube channel — where I teach every concept from scratch, with complete mathematical proofs, examples, and live coding.
🎥 Watch all tutorials here: Code with Bharadwaj
This repository contains efficient, well-structured implementations of core number theory algorithms. Each file is named in order, covering a wide range of concepts — from prime sieving to cryptographic number operations.
Each algorithm comes with:
- ✅ Clean, optimized code for Java and Python
- 🧩 Mathematical explanations behind the logic
- ⚡ Time and space complexity analysis
- 💡 Real-world and competitive programming applications
Topics covered include:
- Prime number generation and testing
- Modular arithmetic and exponentiation
- GCD, LCM, and modular inverses
- Chinese Remainder Theorem
- Euler’s Totient and number-theoretic transforms
- Cryptographic factorization and primality algorithms
I’ve personally explained and demonstrated all these algorithms on my YouTube channel, with visuals, dry runs, and mathematical proofs for each one.
📺 Watch them here → Code with Bharadwaj
Perfect for mastering Number Theory in Competitive Programming and understanding the math behind algorithms like RSA, FFT, and modular systems.
- Languages: Java & Python
- Java I/O: BufferedReader, PrintWriter for fast input/output
- Design: Focused on clarity, modularity, and algorithmic performance
- IDE: IntelliJ IDEA / VS Code
Manu Bharadwaj BN
🎥 YouTube: Code with Bharadwaj
💻 GitHub: Manu577228
🌐 Portfolio
If you find this repository useful:
- ⭐ Star this repository
- 🔔 Subscribe on YouTube
- 🧠 Fork and contribute your implementations
“Mathematics is the language in which God has written the universe.” — Galileo Galilei
Released under the MIT License — feel free to use, modify, and share with proper credit.