This calculator works out Euler's totient, written phi(n), which counts how many whole numbers from 1 up to n share no factor with n other than 1, that is, how many integers in that range are coprime to n. The totient is one of the building blocks of number theory and sits behind RSA encryption, where it fixes the size of the group used for encryption and decryption exponents, and behind other results in modular arithmetic. You enter a whole number n from 2 up to a billion into the single input field. The calculator finds the distinct prime factors of n and applies the formula phi(n) equals n multiplied by (1 minus 1 over p) for every distinct prime p dividing n, rather than testing each number below n for a common factor, which keeps it fast even for very large values. It returns three figures: the totient itself, shown as phi(n) equals the result, the count of distinct prime factors n has, and how many integers up to n are not coprime to n. For example, entering 36, which factorises as 2 squared times 3 squared, returns a totient of 12, two distinct prime factors, and 24 integers that are not coprime to 36. The page below sets out the formula in full, walks through that worked example, and answers common questions about what the totient counts and why it underpins RSA. It suits students checking coursework, programmers implementing cryptographic or combinatorial code, and anyone curious about number theory, and because the result is computed exactly from the prime factorisation, there is no rounding or estimation involved.
Euler’s totient is phi(n) = n times the product over each distinct prime p dividing n of (1 minus 1/p). Equivalently, for each distinct prime you multiply by (p minus 1) and divide by p.
36 = 2 squared times 3 squared, so phi(36) = 36 times (1 minus 1/2) times (1 minus 1/3) = 36 times 1/2 times 2/3 = 12. Enter 36 to confirm.
The whole numbers from 1 to n that are coprime to n, meaning their greatest common factor with n is 1.
p minus 1, because every number from 1 to p minus 1 is coprime to a prime.
The totient of the modulus sets the order of the multiplicative group, which determines the encryption and decryption exponents.
This calculator is for students, programmers and anyone exploring number theory.
If you've found a bug, or would like to contact us, or learn more about James Graham and Calculate.co.nz.
Calculate.co.nz is partnered with Interest.co.nz for New Zealand's highest quality calculators and financial analysis.
Calculate.co.nz is the sister site of CalculatorHub.com, the world's largest calculator website by tool count.
All calculators and tools are provided for educational and indicative purposes only and do not constitute financial advice.
Calculate.co.nz is proudly part of the Realtor.co.nz group, New Zealand's leading property transaction literacy platform, helping Kiwis understand the home buying and selling process from start to finish. Whether you're a first home buyer navigating your first property purchase, an investor evaluating your next acquisition, or a homeowner planning to sell, Realtor.co.nz provides clear, independent, and trustworthy guidance on every step of the New Zealand property transaction journey.
Calculate.co.nz is also partnered with Health Based Building and Premium Homes to promote informed choices that lead to better long-term outcomes for Kiwi households.
Calculate.co.nz is hosted in Auckland by SiteHost New Zealand.
All content on this website, including calculators, tools, source code, and design, is protected under the Copyright Act 1994 (New Zealand). No part of this site may be reproduced, copied, distributed, stored, or used in any form without prior written permission from the owner.
About & trust: Why Calculate is NZ's most comprehensive · By the Numbers · How we compare · Editorial standards · How we keep data current · NZ finance glossary · Research & data · Financial literacy NZ · About · Privacy policy · Terms of use
Reviewed and maintained. Last reviewed 2026-08-15 and checked on a twice-monthly cycle against IRD, RBNZ and Stats NZ. How we keep data current.
© 2026 Calculate.co.nz. All rights reserved. Building free NZ calculators since 2011.