From af2dd8ca06fd22e63f0d18cb69636cb26867de16 Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Sat, 19 Jul 2025 11:08:54 +0800 Subject: [PATCH] feat: update rsa.ipynb --- rsa.ipynb | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/rsa.ipynb b/rsa.ipynb index 1455439..6a34329 100644 --- a/rsa.ipynb +++ b/rsa.ipynb @@ -10,6 +10,26 @@ "$\\phi(n)=n\\prod_{p|n}\\left(1-\\frac{1}{p}\\right)$" ] }, + { + "cell_type": "code", + "execution_count": 12, + "id": "84b0bbc4-48f4-4dc9-a1a9-0cab8f68829a", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "4\n", + "12\n" + ] + } + ], + "source": [ + "print(euler_phi(12))\n", + "print(euler_phi(13))" + ] + }, { "cell_type": "markdown", "id": "0be1d436-5075-4f2f-96ec-e225179209a7", @@ -21,6 +41,26 @@ "\n", "$a^{\\phi(n)}\\equiv1 \\bmod n$" ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "34b39cb0-1bc0-4f35-8c9f-ff47d575bc9e", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1\n", + "1\n" + ] + } + ], + "source": [ + "print(gcd(7,13))\n", + "print(pow(7,euler_phi(13),13))" + ] } ], "metadata": {