Landau Function Calculator
Sequences
- Landau's function g(n) is the largest least common multiple of any partition of n - equivalently, the largest possible order of a permutation of n elements.
- The maximum is always reached by a partition into prime powers of distinct primes, so the search only has to choose one power per prime within the budget n.
- For n = 20 the best choice is 3 + 4 + 5 + 7 (filled out with 1s), whose least common multiple is 420.
- Edmund Landau proved in 1902 that log g(n) grows like the square root of n log n, so the values explode even though the partitions stay small.
Partition the number n into pieces, take the least common multiple of the pieces, and ask: how large can that lcm be? The answer is Landau's function g(n). It is also, by a classical equivalence, the largest possible order of a permutation of n elements - the longest a cycle structure can take to repeat.
This Landau function calculator finds g(n) exactly by choosing, for each prime, the single prime power that buys the most least common multiple within the budget n - the structure every optimal partition has. It reports an achieving partition alongside the value, so the answer can be verified by hand.
The values climb in steps: g(20) = 420 from the partition 3 + 4 + 5 + 7, and g(50) = 180,180 from 4 + 5 + 7 + 9 + 11 + 13. Edmund Landau proved in 1902 that log g(n) grows like the square root of n log n - modest input, explosive output.
Worked examples
g(20)
(Value at n · 20)
| Landau function value g(20) | 420 |
| an achieving partition of 20 | 3 + 4 + 5 + 7 (plus 1s) |
| sum of the parts shown | 19 |
| digits in g(20) | 3 |
g(50)
(Value at n · 50)
| Landau function value g(50) | 180,180 |
| an achieving partition of 50 | 4 + 5 + 7 + 9 + 11 + 13 (plus 1s) |
| sum of the parts shown | 49 |
| digits in g(50) | 6 |
Values g(1) to g(15)
(First n terms · 15)
| Landau function values g(1) to g(15) | 1, 2, 3, 4, 6, 6, 12, 15, 20, 30, 30, 60, 60, 84, 105 |
| last term g(15) | 105 |
| number of terms | 15 |
| first term g(1) | 1 |
Largest lcm of a partition
A partition of n writes it as a sum of positive integers. The lcm of the parts depends on how the budget is spent: one big composite part wastes budget on shared factors, while coprime parts multiply together in full. Landau's function is the maximum over all partitions - the best possible return on the budget n.
For n = 20 the optimum is 3 + 4 + 5 + 7 (filled out with 1s, which change neither the sum constraint nor the lcm). The parts are pairwise coprime prime powers, so the lcm is their product: 3 x 4 x 5 x 7 = 420. No other split of 20 does better.
- g(20) = 420 from 3 + 4 + 5 + 7 (plus 1s)
- Optimal parts are prime powers of distinct primes
- 1s fill the budget for free
Why prime powers win
Any part of a partition can be split into its prime-power components without decreasing the lcm and without increasing the sum - splitting 6 into 2 + 3 keeps the lcm contribution and frees budget. Repeating this argument shows an optimal partition uses at most one power of each prime, and the search reduces to a knapsack-style choice: for every prime, pick the power that buys the most log-lcm per unit of budget.
At n = 50 the best shopping list is 4 + 5 + 7 + 9 + 11 + 13 = 49 (one spare 1), giving lcm 4 x 5 x 7 x 9 x 11 x 13 = 180,180. Note 9 = 3^2 beats spending the same budget on a second power of a prime already chosen - each prime may appear only once, but its power is a free choice.
- One prime power per prime
- g(50) = 180,180 from 4 + 5 + 7 + 9 + 11 + 13
- Splitting composite parts never hurts the lcm
Permutation orders
A permutation of n elements decomposes into cycles, and the cycle lengths form a partition of n. The permutation's order - the number of applications needed to return everything to its place - is the lcm of the cycle lengths. So g(n) is exactly the largest order of any permutation of n elements: choose the cycle structure that Landau's partition describes.
For n = 20, a permutation with cycle lengths 3, 4, 5, 7 (and one fixed point) has order 420: apply it 420 times and every element is home, and no permutation of 20 elements needs more. Group theorists meet g(n) as the maximum element order in the symmetric group S_n.
- Cycle lengths are a partition of n
- Permutation order = lcm of cycle lengths
- g(n) = maximum element order in S_n
Growth and flat stretches
The values g(1) to g(15) run 1, 2, 3, 4, 6, 6, 12, 15, 20, 30, 30, 60, 60, 84, 105 - with visible plateaus at 6, 30 and 60. A plateau means the extra budget cannot afford any prime power that would multiply the running lcm: the money is real but nothing worth buying is in reach. Then a threshold is crossed and the value jumps.
Landau's 1902 theorem quantifies the long run: log g(n) is asymptotic to sqrt(n log n). The function therefore outgrows every polynomial and every exponential with a small base in log terms, yet stays far below n! - a distinctive intermediate growth that made it a favourite example in analytic number theory.
- g(1..15): 1, 2, 3, 4, 6, 6, 12, 15, 20, 30, 30, 60, 60, 84, 105
- Plateaus where no better prime power is affordable
- log g(n) ~ sqrt(n log n) (Landau, 1902)
Worked example: why 420 cannot be beaten at n = 20
Spend the budget greedily on distinct primes: 2 + 3 + 5 + 7 = 17 buys lcm 210, and the remaining 3 cannot improve it. Upgrading powers does better: replacing 2 by 4 costs one more and doubles the lcm contribution of that prime, giving 3 + 4 + 5 + 7 = 19 and lcm 420. The last spare unit becomes a 1. Every alternative - adding 11 (over budget with the rest), using 8 instead of 4 (leaves too little for 5 and 7), or splitting into 2 + 3 + 5 + 7 + smaller pieces - lands at or below 420.
This is the knapsack character of the problem: prime powers are items with a cost (the power itself) and a value (its logarithm), each prime may be bought at most once, and the budget is n. The calculator's search is exactly that optimisation, which is why it stays fast and exact up to n = 60.
- 2 + 3 + 5 + 7 gives only 210
- Upgrading 2 to 4 reaches 420
- A knapsack over prime powers
Landau's function among its neighbours
Several registry neighbours measure nearby extremes. The primorial multiplies the first primes outright; the Chebyshev function sums log p over prime powers up to a bound - the same logarithmic bookkeeping the Landau search uses internally. The Carmichael function gives the maximum order modulo m rather than in the symmetric group, a close cousin with a different stage.
Keeping the definitions separate matters: g(n) is about partitions of the integer n (or permutations of n elements), not about factorials or primorials, although log g(n) ~ sqrt(n log n) can be compared with log(n!) ~ n log n to feel how much smaller the Landau extreme is.
- Primorial: product of the first primes
- Chebyshev: log-sums over prime powers
- Carmichael: maximum order modulo m
Checking a Landau answer by hand
Every value this calculator prints can be audited with three checks on the partition it reports. First, the parts must be prime powers of distinct primes - for g(50), the parts 4, 5, 7, 9, 11, 13 are 2^2, 5, 7, 3^2, 11, 13, one per prime. Second, their sum must fit the budget: 4 + 5 + 7 + 9 + 11 + 13 = 49, which is at most 50, with the slack understood as 1s. Third, since the parts are coprime, their product must be the value: 4 x 5 x 7 x 9 x 11 x 13 = 180,180.
The same audit works at n = 20: parts 3, 4, 5, 7 sum to 19 (at most 20) and multiply to 420. An answer that fails any of the three checks - a repeated prime, an over-budget sum, a product mismatch - is wrong regardless of how it was produced, which is why the achieving partition is part of the output rather than an internal detail.
- Parts: prime powers, distinct primes
- Sum of parts at most n
- Product of parts equals g(n)
Using the calculator
Value mode returns g(n), an achieving partition, the sum of the parts shown, and the digit count of the value. List mode tabulates g(1) through g(n). Values are supported up to n = 60; the prime-power search is exact, and for small n its results agree with a brute-force enumeration of all partitions - the method used to validate this page's examples.
A quick self-check: the parts shown for any n must be prime powers of distinct primes, their sum must not exceed n, and their product must equal the value printed. For n = 50: 4 + 5 + 7 + 9 + 11 + 13 = 49 <= 50 and the product is 180,180.
- Value mode up to n = 60, with achieving partition
- Cross-checked against brute force for small n
- OEIS A000793
FAQs
What is g(20) in Landau's function?
420, achieved by the partition 3 + 4 + 5 + 7 (plus 1s): the parts are coprime, so the least common multiple is their product.
What does Landau's function compute?
The largest least common multiple of any partition of n - equivalently, the largest possible order of a permutation of n elements.
What partition gives g(50)?
4 + 5 + 7 + 9 + 11 + 13 (plus a spare 1), whose lcm is 180,180.
What are the first values of g(n)?
g(1) to g(15): 1, 2, 3, 4, 6, 6, 12, 15, 20, 30, 30, 60, 60, 84, 105.
How does Landau's function relate to permutations?
A permutation's cycle lengths partition n and its order is their lcm, so g(n) is the maximum order of a permutation of n elements - the maximum element order in the symmetric group.
How fast does g(n) grow?
Landau proved in 1902 that log g(n) grows like the square root of n log n - faster than any polynomial in log scale, with flat stretches between affordable prime powers.