{"id":65075,"date":"2025-07-30T09:23:32","date_gmt":"2025-07-30T06:23:32","guid":{"rendered":"https:\/\/wpcalc.com\/en\/?p=65075"},"modified":"2026-09-30T20:30:22","modified_gmt":"2026-09-30T17:30:22","slug":"eulers-theorem","status":"publish","type":"post","link":"https:\/\/wpcalc.com\/en\/mathematics\/eulers-theorem\/","title":{"rendered":"Euler\u2019s Theorem Calculator"},"content":{"rendered":"<section class=\"not-prose calculator-box\" aria-labelledby=\"calculator-title\"><div class=\"flex items-baseline sm:items-center justify-between gap-2 sm:gap-3\"><div class=\"flex flex-col sm:flex-row sm:items-center gap-2\"><span class=\"icon icon-calculator text-primary-700! text-base! dark:text-primary-300!\" aria-hidden=\"true\"><\/span><h2 id=\"calculator-title\" class=\"text-lg font-display font-bold\">Compute Modular Powers Using Euler\u2019s Theorem<\/h2><\/div><div class=\"calcdash-favorite group\">\n  <button type=\"button\" class=\"favorite\" id=\"favorite\" data-favorite-id=\"65075\" data-favorite-title=\"Euler\u2019s Theorem\" data-favorite-url=\"https:\/\/wpcalc.com\/en\/mathematics\/eulers-theorem\/\" data-favorite-excerpt=\"Apply Euler\u2019s Theorem online: enter a base a and a modulus n (coprime), and the calculator computes Euler\u2019s totient \u03c6(n) and a^\u03c6(n) mod n, which always equals 1 when the theorem\u2019s conditions hold.\" aria-label=\"Add to Favorites\" data-favorite-icon=\"icon icon-arithmetic\">\n    <span class=\"icon icon-shape-star-empty\" aria-hidden=\"true\"><\/span>\n  <\/button>\n  <div class=\"calcdash-favorite__tip\" aria-hidden=\"true\">\n   <span class=\"favorite-tooltip\" id=\"favorite-tooltip\"><\/span>\n  <\/div>\n  <span class=\"sr-only\" role=\"status\" id=\"favorite-status\"><\/span>\n<\/div><\/div><form action=\"https:\/\/wpcalc.com\/en\/mathematics\/eulers-theorem\/\" method=\"POST\" class=\"calculator\" id=\"calculator-65075\" data-post=\"65075\"><fieldset class=\"fieldset-input\"><legend class=\"sr-only\">Input Fields<\/legend><div class=\"field\" id=\"input-1\"><label for=\"field-1\">Base number (a)<\/label><input type=\"text\" name=\"base_number_a\" id=\"field-1\" aria-describedby=\"calc-info-1\" data-number inputmode=\"decimal\" autocomplete=\"off\" spellcheck=\"false\" min=\"1\" value=\"3\"\/><small id=\"calc-info-1\">Enter the integer base &quot;a&quot;<\/small><\/div><div class=\"field\" id=\"input-2\"><label for=\"field-2\">Modulus (n)<\/label><input type=\"text\" name=\"modulus_n\" id=\"field-2\" aria-describedby=\"calc-info-2\" data-number inputmode=\"decimal\" autocomplete=\"off\" spellcheck=\"false\" min=\"1\" value=\"7\"\/><small id=\"calc-info-2\">Enter the modulus &quot;n&quot; (should be &gt; 1)<\/small><\/div><\/fieldset><div class=\"buttons\"><button type=\"submit\" data-text=\"Re-Calculate\" id=\"calculate-button\" data-post=\"65075\">Calculate<\/button><button type=\"reset\">Reset<\/button><\/div><div class=\"field is-checkbox hidden!\" id=\"field-auto-calc\"><input type=\"checkbox\" id=\"auto-calc\"><label for=\"auto-calc\">Calculate automatically<\/label><small>If enabled, the result will update automatically when you change any value.<\/small><\/div><div class=\"fieldset-result is-hidden\" aria-labelledby=\"result-title\" aria-live=\"polite\" role=\"region\"> <h3 class=\"result-title bg-gradient-to-r from-primary-50 to-gray-50 dark:from-primary-900 dark:to-gray-800\" id=\"result-title\"><span class=\"icon icon-s-pulse\" aria-hidden=\"true\"><\/span> Your Results<\/h3><div class=\"result-box\"><div class=\"field-result\" id=\"output-1\"><span class=\"field-title\"><span>Euler&#039;s Totient \u03c6(n)<\/span><\/span><span class=\"field-value\" id=\"result-1\"><\/span><button type=\"button\" class=\"copy-result\" data-tooltip=\"Copy Result\" aria-label=\"Copy Result\"><span class=\"copy-icon icon icon-document-copy\" aria-hidden=\"true\"><\/span><\/button><\/div><div class=\"field-result\" id=\"output-2\"><span class=\"field-title\"><span>a^\u03c6(n) mod n<\/span><\/span><span class=\"field-value\" id=\"result-2\"><\/span><button type=\"button\" class=\"copy-result\" data-tooltip=\"Copy Result\" aria-label=\"Copy Result\"><span class=\"copy-icon icon icon-document-copy\" aria-hidden=\"true\"><\/span><\/button><\/div><\/div><div class=\"result-actions\"><button type=\"button\" class=\"copy-link\"><svg viewBox=\"0 0 20 20\" fill=\"currentColor\" aria-hidden=\"true\"><path d=\"M12.232 4.232a2.5 2.5 0 0 1 3.536 3.536l-1.225 1.224a.75.75 0 0 0 1.061 1.06l1.224-1.224a4 4 0 0 0-5.656-5.656l-3 3a4 4 0 0 0 .225 5.865.75.75 0 0 0 .977-1.138 2.5 2.5 0 0 1-.142-3.667l3-3Z\"\/><path d=\"M11.603 7.963a.75.75 0 0 0-.977 1.138 2.5 2.5 0 0 1 .142 3.667l-3 3a2.5 2.5 0 0 1-3.536-3.536l1.225-1.224a.75.75 0 0 0-1.061-1.06l-1.224 1.224a4 4 0 1 0 5.656 5.656l3-3a4 4 0 0 0-.225-5.865Z\"\/><\/svg><span class=\"copy-link__text\">Copy link to this calculation<\/span><\/button><span class=\"sr-only\" role=\"status\" id=\"copy-link-status\"><\/span><\/div><\/div><a href=\"#respond\" class=\"hidden transition-opacity duration-300 opacity-0 w-50 text-sm justify-center items-center gap-2 px-4 py-2 rounded bg-gray-200 text-gray-700 hover:bg-gray-300\" id=\"leave-comment\"><span class=\"icon icon-comments\" aria-hidden=\"true\"><\/span>Leave a Comment<\/a><\/form><\/section><section id=\"calc-reactions\" class=\"not-prose hidden my-12 bg-gradient-to-r from-primary-50 to-gray-50 border border-indigo-100 rounded-xl px-6 py-4 shadow-sm\" data-post=\"65075\" aria-live=\"polite\" aria-labelledby=\"calc-reactions-title\"><p id=\"calc-reactions-title\" class=\"text-sm text-gray-500 text-center mb-2\">How did this result make you feel?<\/p><div role=\"group\" aria-labelledby=\"calc-reactions-title\" class=\"grid grid-cols-3 sm:flex sm:flex-row sm:justify-around gap-4 sm:items-center sm:flex-wrap\"><button type=\"button\" aria-pressed=\"false\" class=\"reaction-btn flex flex-col items-center gap-1 text-sm text-gray-700 hover:text-primary-600 cursor-pointer transition-transform hover:scale-105\" data-reaction=\"like\"><span class=\"reaction-count\" data-reaction-count=\"like\">1<\/span><span class=\"reaction text-3xl\" aria-hidden=\"true\">\ud83d\ude00 <\/span><span class=\"reaction-description font-medium\">Like <\/span><\/button><button type=\"button\" aria-pressed=\"false\" class=\"reaction-btn flex flex-col items-center gap-1 text-sm text-gray-700 hover:text-primary-600 cursor-pointer transition-transform hover:scale-105\" data-reaction=\"helpful\"><span class=\"reaction-count\" data-reaction-count=\"helpful\">1<\/span><span class=\"reaction text-3xl\" aria-hidden=\"true\">\ud83d\udca1 <\/span><span class=\"reaction-description font-medium\">Helpful <\/span><\/button><button type=\"button\" aria-pressed=\"false\" class=\"reaction-btn flex flex-col items-center gap-1 text-sm text-gray-700 hover:text-primary-600 cursor-pointer transition-transform hover:scale-105\" data-reaction=\"confused\"><span class=\"reaction-count\" data-reaction-count=\"confused\">0<\/span><span class=\"reaction text-3xl\" aria-hidden=\"true\">\ud83d\ude15 <\/span><span class=\"reaction-description font-medium\">Confused <\/span><\/button><button type=\"button\" aria-pressed=\"false\" class=\"reaction-btn flex flex-col items-center gap-1 text-sm text-gray-700 hover:text-primary-600 cursor-pointer transition-transform hover:scale-105\" data-reaction=\"disappointed\"><span class=\"reaction-count\" data-reaction-count=\"disappointed\">0<\/span><span class=\"reaction text-3xl\" aria-hidden=\"true\">\ud83d\ude1e <\/span><span class=\"reaction-description font-medium\">Disappointed <\/span><\/button><button type=\"button\" aria-pressed=\"false\" class=\"reaction-btn flex flex-col items-center gap-1 text-sm text-gray-700 hover:text-primary-600 cursor-pointer transition-transform hover:scale-105\" data-reaction=\"inaccurate\"><span class=\"reaction-count\" data-reaction-count=\"inaccurate\">1<\/span><span class=\"reaction text-3xl\" aria-hidden=\"true\">\u274c <\/span><span class=\"reaction-description font-medium\">Inaccurate <\/span><\/button><\/div><div id=\"reaction-message\" class=\"hidden mt-8 rounded-md border border-primary-100 bg-white\/50 backdrop-blur-sm px-4 py-2 text-sm text-center shadow-sm\"><\/div><\/section><div class=\"calcdash-ad not-prose calcdash-ad--calc_result calcdash-ad--in-article\"><ins class=\"adsbygoogle\" style=\"display:block\" data-ad-client=\"ca-pub-1721569815777345\" data-ad-slot=\"6317458308\" data-ad-layout=\"in-article\" data-ad-format=\"fluid\"><\/ins><script>(adsbygoogle = window.adsbygoogle || []).push({});<\/script><\/div>\n<style id=\"wpcoderpro-inline-1\">.formula-box {\r\n\tborder-bottom: none !important;\r\n}<\/style><section class=\"formula-box\" aria-labelledby=\"formula-title\">\r\n\t<div id=\"formula-title\" class=\"not-prose font-display mb-4\"><span class=\"icon icon-formula\" aria-hidden=\"true\"><\/span><h2>Euler\u2019s Theorem Formula<\/h2><\/div>\r\n\t<figure class=\"not-prose formula\">\r\n\t\t<figcaption class=\"formula-title\">Formula<\/figcaption>\r\n\t\t<div class=\"text-base text-gray-800\" id=\"formula\">\n\\[ \\text{If } \\gcd(a, n) = 1, \\quad \\text{then } a^{\\phi(n)} \\equiv 1 \\pmod{n} \\]\n<\/div>\r\n\t<\/figure>\r\n\t<\/p>\n<p><strong>Where:<\/strong><\/p>\n<ul>\n<li>\\(a\\) \u2014 the base, an integer coprime with \\(n\\)<\/li>\n<li>\\(n\\) \u2014 the modulus, a positive integer<\/li>\n<li>\\(\\phi(n)\\) \u2014 Euler\u2019s totient function: the count of integers from \\(1\\) to \\(n\\) that are coprime with \\(n\\)<\/li>\n<li>\\(\\equiv 1 \\pmod{n}\\) \u2014 the left and right sides leave the same remainder \\(1\\) when divided by \\(n\\)<\/li>\n<\/ul>\n<p>The theorem states that whenever \\(a\\) and \\(n\\) share no common factor other than 1, raising \\(a\\) to the power \\(\\phi(n)\\) always yields \\(1\\) modulo \\(n\\). This makes it possible to reduce very large exponents in modular arithmetic to much smaller ones.<\/p>\n<p>\r\n<\/section>\n<style id=\"wpcoderpro-inline-459\">.calculation-box {\r\n\tborder-bottom: none !important;\r\n}<\/style><section id=\"calculation\" class=\"calculation-box\" aria-labelledby=\"calculation-title\">\r\n\t<div id=\"calculation-title\" class=\"not-prose font-display\"><span class=\"icon icon-unordered-list\" aria-hidden=\"true\"><\/span><h2>Euler\u2019s Theorem \u2013 Calculation Example<\/h2><\/div>\r\n\r\n<\/p>\n<p><strong>Example:<\/strong> verify Euler\u2019s Theorem for \\(a = 3\\) and \\(n = 7\\) (the calculator\u2019s default values).<\/p>\n<p><strong>Step 1:<\/strong> check that \\(a\\) and \\(n\\) are coprime:<\/p>\n<p>\\[ \\gcd(3, 7) = 1 \\quad \\checkmark \\]<\/p>\n<p><strong>Step 2:<\/strong> compute the totient of \\(n\\). The numbers coprime with \\(7\\) among \\(1, 2, \\dots, 6\\) are all six of them, so:<\/p>\n<p>\\[ \\phi(7) = 6 \\]<\/p>\n<p><strong>Step 3:<\/strong> raise the base to that power and reduce:<\/p>\n<p>\\[ 3^{6} = 729 \\equiv 1 \\pmod{7} \\]<\/p>\n<p><strong>Result:<\/strong> \\(a^{\\phi(n)} \\bmod n = 1\\), exactly as Euler\u2019s Theorem predicts.<\/p>\n<p>\n\r\n<\/section>\n<h2>How to Use the Calculator<\/h2>\n<ol>\n<li>Enter the integer base <strong>\\(a\\)<\/strong> in the <em>Base number (a)<\/em> field.<\/li>\n<li>Enter the modulus <strong>\\(n\\)<\/strong> in the <em>Modulus (n)<\/em> field. Use a value greater than 1 for a meaningful result.<\/li>\n<li>Read the two outputs: <em>Euler\u2019s Totient \u03c6(n)<\/em> shows how many numbers below \\(n\\) are coprime with it, and <em>a^\u03c6(n) mod n<\/em> shows the modular power.<\/li>\n<li>If you see the message \u201ca and n must be coprime\u201d, choose a different pair \u2014 Euler\u2019s Theorem does not apply when \\(\\gcd(a, n) &gt; 1\\).<\/li>\n<\/ol>\n<h2>What Is Euler\u2019s Theorem?<\/h2>\n<p>Euler\u2019s Theorem, stated by Leonhard Euler in 1763, is one of the central results of number theory. It says that if an integer \\(a\\) shares no common divisor with \\(n\\) other than 1, then \\(a^{\\phi(n)}\\) leaves a remainder of \\(1\\) when divided by \\(n\\). The key quantity here is Euler\u2019s totient function \\(\\phi(n)\\), which counts how many integers between \\(1\\) and \\(n\\) are coprime with \\(n\\). For a prime \\(p\\), every number from \\(1\\) to \\(p-1\\) qualifies, so \\(\\phi(p) = p - 1\\).<\/p>\n<p>The theorem generalizes <a href=\"https:\/\/wpcalc.com\/en\/mathematics\/fermats-little-theorem\/\">Fermat\u2019s Little Theorem<\/a>: setting \\(n = p\\) prime gives \\(a^{p-1} \\equiv 1 \\pmod{p}\\), which is exactly Fermat\u2019s statement. Conversely, Euler\u2019s version works for any modulus, prime or composite, as long as the base and modulus are coprime.<\/p>\n<p>In practice, the theorem is a powerful computational shortcut. To compute something like \\(a^{k} \\bmod n\\) with a huge exponent \\(k\\), you can replace \\(k\\) with \\(k \\bmod \\phi(n)\\), because the exponents repeat with period \\(\\phi(n)\\). This reduction is the reason modular exponentiation with very large numbers stays fast \u2014 a property that modern cryptography depends on.<\/p>\n<p>Indeed, Euler\u2019s Theorem is a cornerstone of <strong>RSA encryption<\/strong>. The private decryption exponent is chosen so that \\(e \\cdot d \\equiv 1 \\pmod{\\phi(n)}\\), which guarantees that raising a ciphertext to the power \\(d\\) recovers the original message. Without Euler\u2019s Theorem, the correctness of RSA could not be proven.<\/p>\n<h2>Assumptions, Limitations and Tips<\/h2>\n<ul>\n<li><strong>Coprimality is required.<\/strong> The theorem holds only when \\(\\gcd(a, n) = 1\\). The calculator checks this and shows an error message otherwise. For example, \\(a = 4\\), \\(n = 6\\) fails because both are divisible by 2.<\/li>\n<li><strong>Modulus must be at least 2.<\/strong> With \\(n = 1\\) every integer is congruent to \\(0\\), so the statement degenerates. Enter \\(n &gt; 1\\).<\/li>\n<li><strong>The result is always 1.<\/strong> When the conditions are met, \\(a^{\\phi(n)} \\bmod n = 1\\) by definition \u2014 the calculator is a verification and learning tool. To actually simplify a custom exponent, reduce it modulo \\(\\phi(n)\\) first and then use fast modular exponentiation.<\/li>\n<li><strong>Computing \\(\\phi(n)\\).<\/strong> This calculator counts coprimes directly, which is fine for small moduli. For large \\(n\\) with known factorization, use \\(\\phi(n) = n \\prod_{p \\mid n} \\left(1 - \\tfrac{1}{p}\\right)\\) instead.<\/li>\n<li><strong>Related tools.<\/strong> To find the number that \u201cundoes\u201d multiplication by \\(a\\) modulo \\(n\\), use the <a href=\"https:\/\/wpcalc.com\/en\/mathematics\/multiplicative-inverse-modulo\/\">Multiplicative Inverse Modulo calculator<\/a>; to solve systems of congruences, see the <a href=\"https:\/\/wpcalc.com\/en\/mathematics\/chinese-remainder-theorem\/\">Chinese Remainder Theorem calculator<\/a>.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Apply Euler\u2019s Theorem online: enter a base a and a modulus n (coprime), and the calculator computes Euler\u2019s totient \u03c6(n) and a^\u03c6(n) mod n, which always equals 1 when the theorem\u2019s conditions hold.<\/p>\n","protected":false},"author":3168,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[7],"tags":[72],"class_list":["post-65075","post","type-post","status-publish","format-standard","hentry","category-mathematics","tag-arithmetic-calculators"],"acf":[],"_links":{"self":[{"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/posts\/65075","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/users\/3168"}],"replies":[{"embeddable":true,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/comments?post=65075"}],"version-history":[{"count":2,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/posts\/65075\/revisions"}],"predecessor-version":[{"id":66235,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/posts\/65075\/revisions\/66235"}],"wp:attachment":[{"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/media?parent=65075"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/categories?post=65075"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/tags?post=65075"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}