Summatory Totient Calculator

Totients

summatory totient Phi(100)3,044
phi(n) itself, the last term added40
Phi(n) / n^20.3044
limiting constant 3 / pi^20.3040
what it counts3,044 reduced fractions between 0 and 1 with denominator up to 100
How this was calculated
  1. The summatory totient Phi(n) adds up Euler's totient over the whole range: Phi(n) = phi(1) + phi(2) + ... + phi(n).
  2. A sieve computes every phi(k) up to 100 at once, and the running total ends at Phi(100) = 3,044.
  3. The count has a picture: Phi(n) is the number of terms in the Farey sequence of order n, minus one - equivalently the reduced fractions between 0 and 1 with denominator at most n.
  4. As n grows, Phi(n) approaches 3 / pi^2 x n^2, so the ratio Phi(n) / n^2 creeps towards 0.3044 - the probability that two random whole numbers are coprime, inverted into a constant.

Euler's totient phi(k) counts the integers up to k that are coprime to k. The summatory totient adds the whole column up: Phi(n) = phi(1) + phi(2) + ... + phi(n). The totals grow quadratically - Phi(10) = 32, Phi(100) = 3,044, Phi(1000) = 304,192 - and they grow towards a famous constant: Phi(n) / n^2 approaches 3 / pi^2, about 0.3040.

That constant is a probability in disguise. Phi(n) counts the reduced fractions between 0 and 1 with denominator at most n - the terms of the Farey sequence - and the density of coprime pairs is governed by 6 / pi^2, the probability that two random integers share no common factor.

This calculator computes Phi(n) with a totient sieve - every phi(k) up to n at once - and reports the last term, the ratio Phi(n) / n^2 and the limiting constant side by side, for n up to 1,000,000.

Worked examples

Summatory totient up to 100

(100)

summatory totient Phi(100)3,044
phi(n) itself, the last term added40
Phi(n) / n^20.3044
limiting constant 3 / pi^20.3040
what it counts3,044 reduced fractions between 0 and 1 with denominator up to 100

Summatory totient up to 1,000

(1000)

summatory totient Phi(1,000)304,192
phi(n) itself, the last term added400
Phi(n) / n^20.3042
limiting constant 3 / pi^20.3040
what it counts304,192 reduced fractions between 0 and 1 with denominator up to 1,000

Summatory totient up to 10

(10)

summatory totient Phi(10)32
phi(n) itself, the last term added4
Phi(n) / n^20.3200
limiting constant 3 / pi^20.3040
what it counts32 reduced fractions between 0 and 1 with denominator up to 10

What the summatory totient adds up

Each totient phi(k) counts the fractions between 0 and 1 with denominator exactly k, in lowest terms - the numerators coprime to k. Summing over all denominators up to n therefore counts fractions by the denominator, which is why the total is a natural object: it is the cumulative census of the reduced fractions. The calculator builds all the totients simultaneously with a sieve - start with phi(k) = k, then for each prime p subtract phi(k) / p from every multiple of p - and sums them.

The worked values show the scale: Phi(10) = 32 from the small totients 1, 1, 2, 2, 4, 2, 6, 4, 6, 4. Phi(100) = 3,044. Phi(1000) = 304,192. Each tenfold increase in n multiplies the total by roughly a hundred - quadratic growth - and the calculator's ratio output shows the constant of that growth emerging.

  • Phi(n) = sum of phi(k) for k = 1..n
  • Computed by a sieve, all totients at once
  • Phi(10) = 32, Phi(100) = 3,044, Phi(1000) = 304,192
  • Supports n up to 1,000,000

The Farey picture

Arrange every reduced fraction between 0 and 1 with denominator at most n in increasing order and you have the Farey sequence of order n. Its length is Phi(n) + 1: the totient sum counts the fractions strictly between the endpoints by their denominators, and the +1 accounts for the endpoints' bookkeeping. So Phi(10) = 32 says the Farey sequence of order 10 has 33 terms, from 0/1 through 1/10, 1/9, 1/8, ... to 1/1.

The calculator phrases one of its outputs in exactly these terms - the count of reduced fractions between 0 and 1 with denominator up to n - because the picture is the fastest way to feel what the number means. A summatory totient is not an abstraction; it is the size of a concrete, listable set of fractions.

  • Phi(n) + 1 = number of Farey terms of order n
  • Farey sequences list reduced fractions between 0 and 1
  • Phi(10) = 32 means 33 Farey fractions of order 10
  • The count includes 0/1 and 1/1 at the ends

The 3 / pi^2 law

Divide Phi(n) by n^2 and the quotient settles: at n = 100 it is 0.3044, at n = 1000 it is 0.3042, and the limit is 3 / pi^2, about 0.3040. The appearance of pi in a counting problem about fractions is the same surprise as in the classic result that two random whole numbers are coprime with probability 6 / pi^2 - both come from the product over primes of (1 - 1/p^2), which telescopes into 1 / zeta(2), and zeta(2) = pi^2 / 6.

The factor of two between 6 / pi^2 and 3 / pi^2 is the geometry of the count: Phi(n) counts coprime pairs (a, b) with a <= b up to scaling - one triangle of the square grid - so it inherits half the coprimality density. The calculator shows the ratio and the constant together so the convergence is something you can measure at several n rather than take on faith.

  • Phi(n) is about (3 / pi^2) n^2
  • Limit of Phi(n) / n^2 is 3 / pi^2 = 0.3040
  • At n = 1000 the ratio is 0.3042 - already close
  • Underneath: P(two random integers coprime) = 6 / pi^2

Worked values and computation

Because the sieve computes every totient in one pass, Phi(n) for n up to 1,000,000 is fast and exact - no floating point enters until the ratio display. The values to anchor on: Phi(10) = 32, Phi(100) = 3,044, Phi(1000) = 304,192, with phi(n) itself reported as the last term added, so the difference between the summatory function and its summand is always visible.

How close Phi(n) sits to (3 / pi^2) n^2 - the error term - is a genuinely deep question, tied through Möbius summation to the distribution of primes; the best bounds (Walfisz and successors) are far weaker than what experiments suggest. The humble running total of the totient thus leads directly to the frontier, like many summatory functions in analytic number theory.

  • Sieve cost is about n log log n operations
  • Exact integer arithmetic - the sum is a whole number
  • Error term in the asymptotic is a deep topic (Walfisz)
  • Related: Mertens-style summatory problems

Computing Phi(n) and the Mobius connection

There is a second way to see the summatory totient that explains its constant. Summing phi(k) over k up to n can be reorganised by the identity sum over d of phi(d) x floor(n / d) = n(n + 1) / 2, and Mobius inversion turns that into a formula for Phi(n) in terms of the Mertens-like sums of the Mobius function. The 3 / pi^2 emerges because the average of phi(k) / k is 6 / pi^2 - the coprimality probability again - and summing that average density over the range produces the quadratic with its constant.

For computation the sieve remains unbeatable at this page's scale: one pass computes every phi(k) up to a million in well under a second, and the running sum is exact integer arithmetic. Beyond that range, the floor-sum identity lets Phi(n) be computed in about n^(2/3) operations by grouping equal values of floor(n / k) - the same trick used for summatory divisor functions - which is how research computations reach n in the billions.

The error term is where the depth hides. Phi(n) minus (3 / pi^2) n^2 oscillates, and bounding it tightly is entangled with the distribution of the Mobius function - the same territory as the Mertens conjecture, which stood for a century before being disproved without a counterexample ever being exhibited. A page that begins by adding totients ends, a few steps later, at genuinely open ground.

  • Identity: sum of phi(d) floor(n/d) equals n(n+1)/2
  • Mobius inversion exposes the 3 / pi^2 constant
  • Floor-sum grouping computes Phi(n) in about n^(2/3)
  • Error term is tied to the Mobius distribution

Worked checks and reading the output

Check the calculator against the smallest case by hand: phi(1) through phi(5) are 1, 1, 2, 2, 4, summing to Phi(5) = 10, and the Farey sequence of order 5 indeed has 11 terms. Then Phi(10) = 32 adds phi(6) through phi(10): 2, 6, 4, 6, 4. The outputs to watch as n grows are the ratio and the gap: Phi(n) / n^2 glides down towards 0.3040 (it is 0.3044 at n = 100 and 0.3042 at n = 1000), while phi(n) itself, reported as the last term, bounces irregularly - the summatory function's smoothness is an averaging phenomenon, and the contrast between the calm total and the jittery last term is the whole story of analytic number theory in one output panel.

  • Phi(5) = 10 by hand; Farey order 5 has 11 terms
  • Ratio glides: 0.3044 at 100, 0.3042 at 1000
  • Calm total, jittery last term

Where the summatory totient is used

Beyond Farey sequences, summatory totients appear wherever coprimality is counted in bulk: the number of visible lattice points in a grid (points (a, b) whose coordinates are coprime are exactly those visible from the origin), the counting of reduced fractions in Diophantine approximation, and the average-case analysis of Euler's totient in cryptography-adjacent estimates. The visible-points picture is the most vivid: shine a light from the origin of an integer lattice and the lit points up to range n are counted, axis corrections aside, by Phi(n) - which is why the density of lit points is the coprimality constant itself.

  • Counts visible lattice points from the origin
  • Core of Farey and Diophantine counting
  • Average totient estimates run through Phi(n)

FAQs

What is the summatory totient?

Phi(n) = phi(1) + phi(2) + ... + phi(n), the running total of Euler's totient. For example Phi(100) = 3,044.

What is Phi(1000)?

304,192.

What does Phi(n) count?

The reduced fractions between 0 and 1 with denominator at most n - equivalently, the number of terms in the Farey sequence of order n, minus one.

What is the limiting value of Phi(n) / n^2?

3 / pi^2, about 0.3040. The ratio climbs slowly towards it: at n = 1000 the ratio is already 0.3042.

What is Phi(10)?

32 - the totients phi(1) through phi(10) are 1, 1, 2, 2, 4, 2, 6, 4, 6, 4, summing to 32.

Why 3 / pi^2?

The probability that two random whole numbers are coprime is 6 / pi^2. Summing totients counts coprime pairs by denominator, and half of that probability survives the count: 3 / pi^2.

Sources

Related calculators

Euler's Totient Calculator
Euler's totient φ(n) — how many integers up to n are coprime to n — from the distinct prime factors of n.
Highly Totient Calculator
Count the solutions to phi(x) = n and test whether n is a highly totient number - a record-setter for totient solution counts.
Jordan Totient Calculator
Jordan's totient function J_k(n) = n^k prod (1 - 1/p^k): the count of k-tuples jointly coprime to n, with J_1(n) = phi(n) and the divisor-sum identity check.