Leonardo Number Calculator

Sequences

Leonardo number L(10)177
previous term L(9)109
next term L(11)287
Fibonacci check: 2 x F(11) - 1177
How this was calculated
  1. The Leonardo numbers follow L(n) = L(n - 1) + L(n - 2) + 1, starting from L(0) = 1 and L(1) = 1 - the Fibonacci recurrence with one extra added at every step.
  2. Running the recurrence up to n = 10 gives L(10) = 177, with neighbours L(9) = 109 and L(11) = 287.
  3. The closed form agrees: L(10) = 2 x F(11) - 1 = 2 x 89 - 1 = 177, where F is the Fibonacci sequence.
  4. Leonardo numbers count, among other things, the leaves of certain recursive trees and the cost of the slowest Fibonacci-style searches; they grow by the golden ratio, just like Fibonacci numbers.

The Leonardo numbers are the Fibonacci sequence's close cousin: the same recurrence, but with one extra added at every step. Starting from L(0) = 1 and L(1) = 1, the sequence runs 1, 1, 3, 5, 9, 15, 25, 41, 67, 109, 177, 287 - always a little ahead of Fibonacci, and growing by the same golden ratio in the long run.

This Leonardo number calculator works two ways. Ask for a single term and it returns L(n) with its neighbours and an independent check through the closed form L(n) = 2F(n + 1) - 1. Ask for the first n terms and it lists them with their sum and the ratio of the last two, so you can watch the golden ratio emerge.

Leonardo numbers turn up wherever a Fibonacci-style recursion carries a constant overhead: they count the leaves of certain recursive trees and the cost of the slowest Fibonacci-style searches, where every level of recursion adds one unit of work on top of the two subproblems.

Worked examples

L(10)

(Value at n · 10)

Leonardo number L(10)177
previous term L(9)109
next term L(11)287
Fibonacci check: 2 x F(11) - 1177

L(20)

(Value at n · 20)

Leonardo number L(20)21,891
previous term L(19)13,529
next term L(21)35,421
Fibonacci check: 2 x F(21) - 121,891

First 12 terms

(First n terms · 12)

first 12 Leonardo numbers1, 1, 3, 5, 9, 15, 25, 41, 67, 109, 177, 287
last term287
sum of the terms740
ratio of the last two terms1.6215

The recurrence: Fibonacci plus one

The definition is a single line: L(n) = L(n - 1) + L(n - 2) + 1, with L(0) = 1 and L(1) = 1. Each term is the sum of the two before it, plus one. That small constant is the whole difference from Fibonacci, and it is exactly what the closed form captures: unrolling the recurrence shows that L(n) = 2F(n + 1) - 1 for the ordinary Fibonacci numbers F.

The calculator uses the identity as an audit, not a shortcut. For n = 10 it reports L(10) = 177 from the recurrence, then confirms 2 x F(11) - 1 = 2 x 89 - 1 = 177. For n = 20 the same double computation gives L(20) = 21,891 both ways. When two genuinely different methods agree, the term is right.

  • L(0) = 1 and L(1) = 1
  • L(n) = L(n - 1) + L(n - 2) + 1
  • Closed form: L(n) = 2F(n + 1) - 1
  • L(10) = 177 and L(20) = 21,891

First terms and their sum

The first 12 terms are 1, 1, 3, 5, 9, 15, 25, 41, 67, 109, 177, 287. They sum to 740, a figure the list mode reports alongside the last term so partial sums can be checked without a second tool. Early on the +1 dominates the behaviour - the sequence doubles and triples quickly - but proportionally its influence fades as the terms grow.

That fading is visible in the ratio of consecutive terms. The ratio of the last two of the first 12 terms is 287 / 177 = 1.6215, already close to the golden ratio 1.618. Because the recurrence differs from Fibonacci's only by a constant, the ratio tends to exactly the same limit; the Leonardo numbers are, asymptotically, just twice the Fibonacci numbers shifted by one index.

  • First 12 terms sum to 740
  • Last-two ratio at 12 terms: 1.6215
  • Long-run growth factor: the golden ratio

Where Leonardo numbers appear

The classic appearance is in algorithm analysis. A recursive procedure that solves two subproblems of sizes n - 1 and n - 2 and does one extra unit of work at each call has a cost that follows the Leonardo recurrence exactly; the slowest Fibonacci-style searches are the textbook example. The same count gives the number of leaves in the recursion trees of those procedures.

They also surface in tiling and composition problems where a strip can be covered in two lengths of tile with an obligatory separator, and in the analysis of Leonardo trees used in smoothsort - Edsger Dijkstra's heap variant, whose heap shape is built from Leonardo numbers. If you meet a recurrence of the form 'sum of the previous two, plus a constant', a Leonardo-type closed form is usually hiding inside it.

  • Recursion costs with constant per-call overhead
  • Leaves of Leonardo trees in smoothsort
  • Tilings with an obligatory separator

Leonardo, Fibonacci and Lucas

Three sequences share the same additive skeleton. Fibonacci starts 0, 1 and adds nothing; Lucas starts 2, 1 and adds nothing; Leonardo starts 1, 1 and adds one at each step. The closed forms reflect this: Fibonacci is a difference of two golden-ratio powers, Lucas is their sum, and Leonardo is twice a shifted Fibonacci number minus one.

A practical consequence: any identity you know for Fibonacci numbers translates into a Leonardo identity through L(n) = 2F(n + 1) - 1. Summing the first n Leonardo numbers, for instance, reduces to summing shifted Fibonacci numbers, which is why the first 12 terms can be totalled as 740 without adding them one by one - although the calculator happily does that too, as a check.

  • Fibonacci: seeds 0, 1, no constant
  • Lucas: seeds 2, 1, no constant
  • Leonardo: seeds 1, 1, constant +1

Worked example: L(10) two ways

By the recurrence: L(8) = 67 and L(9) = 109 are already in hand from the list 1, 1, 3, 5, 9, 15, 25, 41, 67, 109, so L(10) = 109 + 67 + 1 = 177. One more step gives L(11) = 177 + 109 + 1 = 287. Nothing but addition is involved, which is why the recurrence is the definition of record.

By the closed form: F(11) = 89, so L(10) = 2 x 89 - 1 = 177. The two routes share no arithmetic steps, so their agreement is a genuine check - the same check the calculator performs and reports for every value-mode query, including L(20) = 21,891 = 2 x F(21) - 1.

  • Recurrence: 109 + 67 + 1 = 177
  • Closed form: 2 x 89 - 1 = 177
  • Agreement of independent methods is the audit

Common mistakes

The first is seeding: Leonardo starts 1, 1 - not 0, 1 like Fibonacci and not 1, 2. With the wrong seeds the +1 recurrence produces a different sequence entirely (in fact a shifted Fibonacci). The second is dropping the +1 halfway: it is added at every step, including the step that produces L(2) = 3 from 1, 1, 1.

The third is assuming the closed form needs the golden ratio and rounding. It does not: L(n) = 2F(n + 1) - 1 is exact integer arithmetic. Binet-style formulas with square roots of 5 are elegant but numerically treacherous for large n; the recurrence and the Fibonacci identity are the reliable routes, and they are what this page uses.

  • Seeds are 1, 1
  • The +1 is added at every step
  • Prefer integer routes over Binet rounding

Why the +1 matters

It is tempting to treat the Leonardo numbers as 'Fibonacci with a fudge factor', but the constant changes the character of the sequence in ways that matter for its applications. In the recursion-cost reading, the +1 is the actual work done at each call - dropping it does not approximate the cost, it deletes it. A Fibonacci estimate of a Leonardo process is not slightly wrong; it is wrong by exactly the accumulated overhead, which is the part the analysis usually cares about.

The closed form shows the same point algebraically. L(n) = 2F(n + 1) - 1 says the Leonardo number is pinned to twice a Fibonacci number, with the -1 removing the double-counted seed. At n = 10 the two candidate answers - 177 from the identity, 178 from forgetting the -1 - differ by exactly the seed correction. The calculator's habit of computing both routes is what keeps that one-unit error, the most common Leonardo mistake of all, from surviving to the answer.

  • The +1 is the per-call work in cost recurrences
  • Forgetting the -1 in 2F(n + 1) - 1 overstates L(10) as 178
  • Dual computation is the guard

Using the calculator

Choose 'Value at n' for a single term - the answer comes with the previous and next terms, which makes off-by-one errors obvious, plus the Fibonacci closed-form check. Choose 'First n terms' for the list, its sum, and the last-two ratio. Terms up to n = 60 are supported in value mode; the numbers stay exact throughout, because the recurrence is pure integer arithmetic.

A good sanity check when exploring: pick any n and compare L(n) with 2F(n + 1) - 1 from a Fibonacci table. The two must match to the last digit - for n = 20, both give 21,891.

  • Value mode: term, neighbours, closed-form check
  • List mode: terms, sum, last-two ratio
  • Exact integer arithmetic throughout

FAQs

What is the 10th Leonardo number?

L(10) = 177. Its neighbours are L(9) = 109 and L(11) = 287, and the closed form confirms it: 2 x F(11) - 1 = 177.

How are Leonardo numbers calculated?

By the recurrence L(n) = L(n - 1) + L(n - 2) + 1 from L(0) = 1 and L(1) = 1 - the Fibonacci recurrence with one added at every step.

What is the closed form of the Leonardo numbers?

L(n) = 2F(n + 1) - 1, where F is the Fibonacci sequence. For n = 20: 2 x F(21) - 1 = 21,891.

What are the first Leonardo numbers?

1, 1, 3, 5, 9, 15, 25, 41, 67, 109, 177, 287. The first 12 sum to 740.

How fast do Leonardo numbers grow?

By the golden ratio, like Fibonacci numbers. The ratio of the last two of the first 12 terms is already 1.6215, closing on 1.618.

Where are Leonardo numbers used?

In algorithm analysis - recursion costs with a constant overhead per call, the slowest Fibonacci-style searches, and the Leonardo trees behind Dijkstra's smoothsort.

Sources

Related calculators

Fibonacci Calculator
The nth Fibonacci number, computed exactly with arbitrary-precision arithmetic — plus the next term, the sum of the first n terms, and how close the ratio has come to the golden ratio.
Lucas Number Calculator
The nth Lucas number by its recurrence, with the companion Fibonacci number, the identity check L(n) = F(n-1) + F(n+1) and the ratio that converges to the square root of five.
Tribonacci Number Calculator
The nth Tribonacci number, where each term is the sum of the three before it, with the previous term, the running sum and the ratio approaching the tribonacci constant.