standarddeviationcalculator.net

Updated Free · runs in your browser

Math

Number theory calculator

Enter a positive whole number to see the standard number-theory functions worked out from its prime factorisation, plus its digit sum, digital root and Collatz sequence.

Any positive whole number up to 10²⁰.

Classification of 28 Perfect
Prime factorisation2² × 7
Euler’s totient φ(n)12
Number of divisors τ(n)6
Sum of divisors σ(n)56
Aliquot sum s(n) = σ(n) − n28
ClassificationPerfect
Möbius function μ(n)0
Digit sum10
Digital root1
Collatz steps to reach 118
Highest Collatz value52
02468101214161801020304050 peak 52 step value
Show the working, step by step
  1. Factorise n. Every function below is built from the prime powers.

    28 = 2² × 7

  2. Euler’s totient φ(n) counts the numbers from 1 to n that share no factor with n. Multiply n by (1 − 1/p) for each distinct prime p.

    φ(28) = 28 × (1 − 1/2) × (1 − 1/7) = 12

  3. Number of divisors τ(n): add 1 to each exponent and multiply.

    τ = (2 + 1) × (1 + 1) = 6

  4. Sum of divisors σ(n): multiply (1 + p + p² + … + pᵉ) over the prime powers.

    σ = (1 + 2 + 4) × (1 + 7) = 56

  5. Perfect, abundant or deficient: compare the proper divisors’ sum s(n) = σ(n) − n with n.

    s(28) = 56 − 28 = 28 = 28 → perfect

  6. Möbius function μ(n): 0 if any prime appears squared or higher, otherwise +1 for an even number of primes and −1 for an odd number.

    2² divides n → μ = 0

  7. Digit sum and digital root: add the digits, and keep adding until one digit is left.

    2 + 8 = 10 → 1 (digital root 1)

  8. Collatz sequence: halve n if it is even, otherwise replace it with 3n + 1, and count the steps to reach 1.

    28 → 14 → 7 → 22 → 11 → 34 → 17 → 52 → 26 → 13 → 40 → 20 → 10 → 5 → 16 → 8 → 4 → 2 → 1 18 steps, peak 52

The digital root is also n mod 9 (with 9 in place of 0): 28 mod 9 = 1. That is why casting out nines checks arithmetic.

The functions and their formulas

With n = p₁^e₁ × … × pₖ^eₖ:

FunctionMeaningFormula
φ(n)Numbers 1…n coprime to nn ∏ (1 − 1/pᵢ)
τ(n)Number of divisors∏ (eᵢ + 1)
σ(n)Sum of divisors∏ (1 + pᵢ + … + pᵢ^eᵢ)
s(n)Sum of proper divisors (aliquot sum)σ(n) − n
μ(n)Möbius function0 if any eᵢ > 1, else (−1)ᵏ
Digital rootRepeated digit sum1 + (n − 1) mod 9

All but the digit functions depend only on the prime factorisation, which is why the calculator factorises first. φ, τ, σ and μ are multiplicative: for coprime a and b, f(ab) = f(a) f(b).

A worked example: 28

  • 28 = 2² × 7.
  • φ(28) = 28 × (1 − ½) × (1 − 1/7) = 12.
  • τ(28) = (2 + 1)(1 + 1) = 6: the divisors are 1, 2, 4, 7, 14 and 28.
  • σ(28) = (1 + 2 + 4)(1 + 7) = 56, so s(28) = 56 − 28 = 28, and 28 is perfect.
  • μ(28) = 0, because 2² divides 28.
  • Digit sum 2 + 8 = 10; digital root 1 + 0 = 1 (and 28 mod 9 = 1).
  • Collatz: 28 → 14 → 7 → 22 → 11 → 34 → 17 → 52 → 26 → 13 → 40 → 20 → 10 → 5 → 16 → 8 → 4 → 2 → 1, which is 18 steps with a peak of 52.

Why these functions matter

Euler’s theorem says a^φ(n) ≡ 1 (mod n) whenever a and n are coprime. That is what makes RSA decryption undo encryption, and it gives a quick way to reduce huge exponents in the modular arithmetic calculator. The divisor functions classify numbers (perfect, abundant, deficient) and appear throughout analytic number theory. Digital roots are an old check on hand arithmetic, and the Collatz sequence is a famous example of a simple rule nobody can yet analyse.

Things to watch

  • φ counts coprime numbers, not primes. φ(28) = 12, but there are only 9 primes below 28.
  • σ includes n itself. Use s(n) = σ(n) − n to test for perfect numbers.
  • 1 is special. φ(1) = τ(1) = σ(1) = μ(1) = 1, it has no prime factors, and it is deficient.

Common questions

What is Euler’s totient function?

φ(n) counts the whole numbers from 1 to n that share no common factor with n. For 28, the numbers 1, 3, 5, 9, 11, 13, 15, 17, 19, 23, 25 and 27 qualify, so φ(28) = 12. From the prime factorisation, φ(n) = n × (1 − 1/p) for each distinct prime p: 28 × ½ × 6/7 = 12. For a prime p, φ(p) = p − 1. The totient is at the heart of RSA encryption.

What makes a number perfect, abundant or deficient?

Add up its proper divisors (every divisor except the number itself). If the sum equals the number it is perfect: 1 + 2 + 4 + 7 + 14 = 28. If the sum is bigger it is abundant: 12 has 1 + 2 + 3 + 4 + 6 = 16. If smaller, deficient: 8 has 1 + 2 + 4 = 7. Every prime is deficient, since its only proper divisor is 1.

Which numbers are perfect?

Only about fifty are known (52 as of 2024), and all are even: 6, 28, 496, 8,128, 33,550,336 and then much larger ones. Each has the form 2^(p−1) × (2^p − 1) where 2^p − 1 is a Mersenne prime. Whether an odd perfect number exists is one of the oldest open problems in mathematics.

What is a digital root?

Add the digits, then add the digits of the result, until one digit is left. For 9,875: 9 + 8 + 7 + 5 = 29, then 2 + 9 = 11, then 1 + 1 = 2. It equals n mod 9, with 9 in place of 0, which is why casting out nines can check additions and multiplications.

What is the Collatz conjecture?

Start with any positive whole number. If it is even, halve it; if odd, multiply by 3 and add 1. The conjecture says you always reach 1. It has been checked by computer for every number up to more than 10²⁰ but never proved. Some small numbers take a long route: 27 needs 111 steps and climbs as high as 9,232 before falling to 1.

What does the Möbius function μ(n) tell you?

μ(n) is 0 if n is divisible by a square greater than 1 (such as 4 or 9), and otherwise +1 or −1 depending on whether n has an even or odd number of prime factors. So μ(28) = 0 because 4 divides 28, μ(30) = −1 (three primes) and μ(1) = 1. It is used to invert sums over divisors.