diff --git a/CHANGELOG.md b/CHANGELOG.md index 232ba4a..96a4065 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ -## v0.1.0 (09/01/2025) +## v0.1.0 -- First release of `num_theory`! \ No newline at end of file +- First release of `num_theory`! +- Established the package structure. +- Added function placeholders with corresponding docstrings. + +## v1.0.0 + +- Implemented all functions within the package. +- Added comprehensive tests for all package functionalities. \ No newline at end of file diff --git a/README.md b/README.md index d9734b5..cc66a0c 100644 --- a/README.md +++ b/README.md @@ -65,11 +65,9 @@ This package complements existing Python libraries by offering a targeted collec Related Packages: -• SymPy: This does provide some symbolic mathematics, including some number theory, but isn't optimized for the computational challenges of advanced number theory. - -• NumPy: The general-purpose library for numerical computations, but not specialized in number theory. - -• primesieve: A highly efficient library for prime generation. This package provides similar functionalities. +- SymPy: This does provide some symbolic mathematics, including some number theory, but isn't optimized for the computational challenges of advanced number theory. +- NumPy: The general-purpose library for numerical computations, but not specialized in number theory. +- primesieve: A highly efficient library for prime generation. This package provides similar functionalities. ## Comparison with Other Libraries diff --git a/docs/example.ipynb b/docs/example.ipynb index ab97648..378fb7f 100644 --- a/docs/example.ipynb +++ b/docs/example.ipynb @@ -22,7 +22,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 1, "metadata": {}, "outputs": [ { @@ -48,7 +48,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -107,7 +107,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 3, "metadata": {}, "outputs": [ { @@ -144,7 +144,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 4, "metadata": {}, "outputs": [ { @@ -189,7 +189,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -270,7 +270,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 6, "metadata": {}, "outputs": [ { @@ -300,7 +300,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 7, "metadata": {}, "outputs": [ { @@ -329,7 +329,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 8, "metadata": {}, "outputs": [ { @@ -415,7 +415,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 9, "metadata": {}, "outputs": [ { @@ -456,7 +456,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 10, "metadata": {}, "outputs": [ { @@ -529,50 +529,77 @@ "```\n", "\n", "---\n", - "### Application 1: Prime Pattern Finder\n", + "### Application 1: Cryptography & Security PIN Validation\n", "\n", - "By filtering prime numbers that satisfy the pattern $p = 6k \\pm 1$, this demonstrates how mathematical properties can be utilized to further refine prime numbers." + "In cryptography, prime numbers are widely used for secure encryption. A system might validate that a chosen PIN is prime before accepting it as secure.\n" ] }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 11, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Special primes (6k ± 1) between 2 and 200: [5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199]\n" + "PIN 53 is accepted as it's a prime number—secure and unique!\n" ] } ], "source": [ "from num_theory.is_prime import is_prime\n", + "pin = 53\n", + "if is_prime(pin):\n", + " print(f\"PIN {pin} is accepted as it's a prime number—secure and unique!\")\n", + "else:\n", + " print(f\"PIN {pin} is rejected. Please choose a prime number.\")\n", + "# Output: PIN 53 is accepted as it's a prime number—secure and unique!\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Application 2: Unique Classroom Groups\n", "\n", - "# Find primes matching the pattern\n", - "def find_special_primes(start, end):\n", - " primes = [n for n in range(start, end + 1) if is_prime(n)]\n", - " special_primes = [p for p in primes if (p - 1) % 6 == 0 or (p + 1) % 6 == 0]\n", - " return special_primes\n", - "\n", - "# Find special primes in the range\n", - "special_primes = find_special_primes(2, 200)\n", - "print(f\"Special primes (6k ± 1) between 2 and 200: {special_primes}\")" + "A teacher wants to divide students into groups of a size that is prime, ensuring groups are small and effective." + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Group size 7 works! It's prime, so students will interact uniquely.\n" + ] + } + ], + "source": [ + "group_size = 7\n", + "if is_prime(group_size):\n", + " print(f\"Group size {group_size} works! It's prime, so students will interact uniquely.\")\n", + "else:\n", + " print(f\"Group size {group_size} isn't prime. Let's try a different size.\")\n", + "# Output: Group size 7 works! It's prime, so students will interact uniquely." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "### Application 2: Generate RSA Keys\n", + "### Application 3: Generate RSA Keys\n", "\n", "In encryption applications, generating an RSA key pair (public and private keys) requires two large prime numbers and modulus calculations. This code uses `is_prime` to verify the generated prime numbers and constructs the RSA public and private keys, showcasing a practical application in a real-world encryption system." ] }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 13, "metadata": {}, "outputs": [ { @@ -580,8 +607,8 @@ "output_type": "stream", "text": [ "RSA Keys:\n", - "Public Key: (52931, 126169)\n", - "Private Key: (44011, 126169)\n" + "Public Key: (14315, 62429)\n", + "Private Key: (40511, 62429)\n" ] } ], @@ -653,7 +680,7 @@ ], "metadata": { "kernelspec": { - "display_name": "524", + "display_name": "test_env", "language": "python", "name": "python3" },