Leyland Number Calculator

Exponents

Leyland number x^y + y^x320
x^y term256
y^x term64
Digits in the result3
How this was calculated
  1. Leyland numbers are the values of x^y + y^x for integers x and y of at least 2, a form studied by Paul Leyland in prime hunting.
  2. With x = 2 and y = 8: x^y = 2^8 = 256 and y^x = 8^2 = 64.
  3. Adding the two terms gives the Leyland number 256 + 64 = 320.
  4. The result has 3 digits; swapping x and y leaves x^y + y^x unchanged, so each unordered pair produces one number.

The Leyland Number Calculator computes Leyland numbers, which are the values of x^y + y^x for integers x and y of at least 2. Enter your two integers and the calculator raises each one to the power of the other, then adds the two results. For example, x = 2 and y = 8 gives 2^8 + 8^2 = 256 + 64 = 320. With x = 3 and y = 5, you get 3^5 + 5^3 = 243 + 125 = 368. Some results are prime: 2^9 + 9^2 = 512 + 81 = 593, which is a Leyland prime. Because swapping x and y gives the same value, each unordered pair is counted once, so 8 and 2 produce the same 320 as 2 and 8.

The method behind the calculator is direct evaluation of the defining expression x^y + y^x, the accepted standard for this kind of calculation because it applies the definition exactly as stated, with no shortcuts or approximations. Each term is computed by exponentiation and the two terms are then added, so the result follows from the formula itself. This page shows that formula, the step-by-step workings for each calculation, worked examples such as 2^8 + 8^2 = 320 and 3^5 + 5^3 = 368, and the sources used. You can check every step by hand and see exactly how each Leyland number is produced.

Worked examples

2^8 + 8^2

(2 · 8)

Leyland number x^y + y^x320
x^y term256
y^x term64
Digits in the result3

3^5 + 5^3

(3 · 5)

Leyland number x^y + y^x368
x^y term243
y^x term125
Digits in the result3

2^9 + 9^2, a Leyland prime

(2 · 9)

Leyland number x^y + y^x593
x^y term512
y^x term81
Digits in the result3

A two-term power sum

A Leyland number is what you get when you take two integers, each at least 2, raise the first to the power of the second, raise the second to the power of the first, and add the two results. The form is written x^y + y^x. It looks compact, but it hides two separate exponential calculations that must be finished before the final addition. That order matters, and it is exactly what a Leyland number calculator is built to handle without mixing up the steps.

Take the pair x = 2 and y = 8. The first term is 2^8, which equals 256. The second term is 8^2, which equals 64. Only after both powers are computed do you add them: 256 + 64 = 320. The two terms are not interchangeable in the middle of the work — 2^8 and 8^2 are very different numbers — even though the finished sum comes out the same if you swap the inputs. Computing each power on its own keeps the arithmetic clean and makes it easy to check where a mistake crept in.

A second example shows the same pattern with different digits. With x = 3 and y = 5, the first term is 3^5 = 243 and the second is 5^3 = 125. Adding them gives 243 + 125 = 368. Again, the exponent applies to the base in each term separately: the 3 is raised to the fifth power, and the 5 is raised to the third power. Neither term is 3 × 5 or 5 × 3; the operation is exponentiation, not multiplication, and the gap between 243 and 125 shows how quickly the two terms can diverge.

Not every Leyland number is composite. With x = 2 and y = 9, the terms are 2^9 = 512 and 9^2 = 81, and their sum is 512 + 81 = 593. That value is prime, which makes it a Leyland prime. Results like this are why the calculation is worth doing carefully rather than estimating: a small change in either input can move the total into or out of the prime category, and the only way to know is to compute both powers exactly and then add.

  • Write the form as x^y + y^x, with x and y each at least 2.
  • Compute x^y first, then y^x, and add only after both are done.
  • Example: 2^8 + 8^2 = 256 + 64 = 320.
  • Example: 3^5 + 5^3 = 243 + 125 = 368.
  • Example: 2^9 + 9^2 = 512 + 81 = 593, a Leyland prime.
  • Swapping x and y gives the same value, so each unordered pair is counted once.
The two powers are separate calculations: in 2^8 + 8^2, the 256 and the 64 come from different bases and different exponents, and only the final addition combines them.

Leyland primes

Most Leyland numbers are composite, but not all of them. Take the pair x = 2 and y = 9. Working it out, 2^9 + 9^2 = 512 + 81 = 593, and 593 is prime. A value of this form that turns out to be prime is called a Leyland prime. The same calculation is what a Leyland number calculator performs for any pair you enter: it raises x to the power y, raises y to the power x, and adds the two results. When that sum has no divisors other than 1 and itself, you have found a Leyland prime.

The example above shows why the form is easy to miss as a source of primes. The two terms being added are very different in size — here 512 and 81 — and their sum, 593, does not look obviously prime at a glance. Checking it requires testing divisors, which is exactly the work a calculator can do for you. Because the target keyword describes the whole tool, it is worth remembering that the calculator returns the Leyland number itself; deciding whether that number is prime is a separate step, but one the same tool can support.

The structure of the form is part of what makes it interesting. Because swapping x and y gives the same value, each unordered pair is counted once. The pair (2, 9) and the pair (9, 2) both produce 593; they are not two different Leyland numbers but one, reached two ways. That symmetry halves the number of distinct pairs you need to consider, which matters when you are searching a range for primes rather than checking a single pair.

Not every pair yields a prime, of course. With x = 2 and y = 8, the calculation gives 2^8 + 8^2 = 256 + 64 = 320, a composite number. With x = 3 and y = 5, it gives 3^5 + 5^3 = 243 + 125 = 368, also composite. Seeing both outcomes side by side is useful: it shows that primality is not guaranteed by the form, and that the only way to know is to compute the value and test it.

This mix of simple construction and unpredictable results is what attracted prime hunters to the form. The rule for building a Leyland number is short enough to state in a sentence, yet the values it produces vary widely in size and in whether they are prime. A searcher can generate candidates systematically, pair by pair, and check each sum. The Leyland prime 593, sitting quietly at 2^9 + 9^2, is a small reminder of why people keep looking.

xyCalculationValuePrime?
282^8 + 8^2 = 256 + 64320No
353^5 + 5^3 = 243 + 125368No
292^9 + 9^2 = 512 + 81593Yes — a Leyland prime
A Leyland number is prime when x^y + y^x has no divisors other than 1 and itself. For x = 2 and y = 9, the sum is 593 — a Leyland prime.

How fast the values grow

The first Leyland numbers are small enough to work out in your head. With x = 2 and y = 8, you get 2^8 + 8^2 = 256 + 64 = 320. Nudge the pair to x = 3 and y = 5 and the result is 3^5 + 5^3 = 243 + 125 = 368. These are comfortable, three-digit answers, and it is tempting to assume the sequence stays that tame. It does not. The structure of the formula — one term raised to a power, plus the other base raised to the other power — means both terms grow at once, so the sum climbs much faster than either base alone would suggest.

A small change in the exponents is enough to show the shift. Take x = 2 and y = 9: 2^9 + 9^2 = 512 + 81 = 593. That is still a three-digit number, but it sits well above the 320 and 368 produced by nearby pairs, and 593 happens to be prime, which makes it a Leyland prime. From here the curve steepens sharply. Each extra unit in an exponent multiplies that term rather than adding to it, and because both terms are powered, the total can jump from hundreds to thousands to millions within a short stretch of the grid. Pairs that look almost identical on paper can land in completely different ranges.

This is where a leyland number calculator earns its place. Doing 320 or 368 by hand is trivial; doing larger pairs by hand is not, and the size of the answer is exactly what makes manual work error-prone. The calculator handles the exponentiation for you and reports the digit count alongside the value, so you can see at a glance whether a result is a modest three-digit figure or a number that runs for dozens of digits. That digit count is often more useful than the value itself when you are comparing pairs, because it tells you instantly which region of the sequence you are looking at without counting characters on screen.

Remember also that swapping x and y gives the same value, so each unordered pair is counted once. The pair (2, 8) and the pair (8, 2) both produce 320; there is no second, larger number hiding behind the swap. That keeps the sequence from doubling up, but it does nothing to slow the growth. The gentle 320 is simply the shallow end. As the exponents climb, the values move through the hundreds, the thousands and far beyond, and the digit count the calculator returns is the quickest way to keep your bearings as the numbers expand.

2^8 + 8^2 = 320 is a three-digit result, but nearby pairs already reach 593 (2^9 + 9^2), which is prime — a Leyland prime. Small changes in the exponents produce large changes in the answer.

Counting each pair once

Leyland numbers are the values of x^y + y^x for integers x and y of at least 2. The first thing to notice about that definition is that the order of the two inputs does not matter. Because addition is commutative, swapping x and y gives the same value: x^y + y^x is identical to y^x + x^y. The pair (2, 8) and the pair (8, 2) both produce 2^8 + 8^2 = 256 + 64 = 320. There is no second Leyland number hiding at 320; it is one value that two different ordered pairs happen to reach.

This symmetry has a practical consequence for anyone generating a list. If you looped over every ordered pair with x and y each at least 2, you would compute each Leyland number twice, once as (x, y) and once as (y, x), and your list would be full of duplicates. To avoid that, listings of Leyland numbers impose an ordering on the pair. The usual convention is to require x to be less than or equal to y, so only pairs such as (2, 8) are admitted and (8, 2) is skipped. Every unordered pair is then counted exactly once, and each distinct value appears a single time in the output.

The ordering is a bookkeeping rule, not a claim that the two inputs play different roles in the arithmetic. It simply picks one representative from each symmetric pair so the collection stays clean. Note also that even with the ordering in place, different pairs can still land on the same value, which is why a careful listing reports distinct Leyland numbers rather than distinct pairs. The ordering removes the guaranteed duplication from swapping; it does not promise that every remaining pair yields a brand-new number.

A few worked values show how the rule plays out. The pair (2, 8) gives 320, and (3, 5) gives 3^5 + 5^3 = 243 + 125 = 368. The pair (2, 9) gives 2^9 + 9^2 = 512 + 81 = 593, which is prime — a Leyland prime. In each case the smaller input is written first, and the reversed pair is understood to be the same entry. When you use a Leyland number calculator, this is the convention it follows: it treats the pair as unordered, counts each unordered pair once, and returns the value of x^y + y^x without listing the mirror image as a separate result.

Keeping the ordering in mind also helps you check results by hand. If you compute a value from a pair and then compute it again with the inputs swapped, getting the same answer is expected, not an error. The symmetry is built into the definition, and the ordering convention is simply how lists and calculators respect it.

Swapping x and y never changes the value, so lists require x ≤ y to count each unordered pair once.

FAQs

What is a Leyland number?

A Leyland number is a number of the form x^y + y^x, where x and y are integers of at least 2. The form is named after Paul Leyland. Because both bases must be 2 or larger, the smallest cases use small integers raised to each other's powers and then added together.

What is 2^8 + 8^2?

2^8 + 8^2 equals 320. The two terms are 256 and 64, and adding them gives 320. This is a straightforward example of the Leyland form: raise each base to the other's exponent, then add the two results. Here x is 2 and y is 8, both at least 2.

What is a Leyland prime?

A Leyland prime is a Leyland number that is also prime. One of the small examples is 593, which equals 2^9 + 9^2. So 593 fits the Leyland form and has no divisors other than 1 and itself. Such primes are the focus when people search Leyland numbers for large prime values.

Does the order of x and y matter?

No. The expression x^y + y^x is symmetric, so swapping the two integers gives the same result. For example, the pair (2, 9) and the pair (9, 2) both produce 593. Because of this symmetry, each unordered pair of integers of at least 2 defines a single Leyland number.

What is 3^5 + 5^3?

3^5 + 5^3 equals 368. The two terms are 243 and 125, and adding them gives 368. Here x is 3 and y is 5, both integers of at least 2, so the result fits the Leyland form. This is another small worked example of the x^y + y^x pattern.

Why do people compute Leyland numbers?

Large Leyland numbers are a hunting ground for big prime numbers. The form is easy to state and easy to test, which makes it practical to search many candidates. People compute them to look for new large primes among the values that the simple x^y + y^x pattern produces.

Sources

Related calculators

Exponent Calculator
Any base to any power — whole, negative and fractional exponents — with squares and cubes for reference.
Mersenne Prime Calculator
Test whether a Mersenne number 2^p - 1 is prime with the Lucas-Lehmer test, for exponents up to 61.
Prime Factorization Calculator
Break any whole number up to a trillion into its prime factors — with divisor count, divisor sum and largest prime factor.