Leonardo number

From testwiki
Jump to navigation Jump to search

Template:Short description Template:Primary sources The Leonardo numbers are a sequence of numbers given by the recurrence:

L(n)={1if n=01if n=1L(n1)+L(n2)+1if n>1

Edsger W. Dijkstra[1] used them as an integral part of his smoothsort algorithm,[2] and also analyzed them in some detail.[3] [4]

A Leonardo prime is a Leonardo number that is also prime.

Values

The first few Leonardo numbers are

1, 1, 3, 5, 9, 15, 25, 41, 67, 109, 177, 287, 465, 753, 1219, 1973, 3193, 5167, 8361, ... Template:OEIS

The first few Leonardo primes are

3, 5, 41, 67, 109, 1973, 5167, 2692537, 11405773, 126491971, 331160281, 535828591, 279167724889, 145446920496281, 28944668049352441, 5760134388741632239, 63880869269980199809, 167242286979696845953, 597222253637954133837103, ... Template:OEIS

Modulo cycles

The Leonardo numbers form a cycle in any modulo n≥2. An easy way to see it is:

  • If a pair of numbers modulo n appears twice in the sequence, then there's a cycle.
  • If we assume the main statement is false, using the previous statement, then it would imply there's infinite distinct pairs of numbers between 0 and n-1, which is false since there are n2 such pairs.

The cycles for n≤8 are:

Modulo Cycle Length
2 1 1
3 1,1,0,2,0,0,1,2 8
4 1,1,3 3
5 1,1,3,0,4,0,0,1,2,4,2,2,0,3,4,3,3,2,1,4 20
6 1,1,3,5,3,3,1,5 8
7 1,1,3,5,2,1,4,6,4,4,2,0,3,4,1,6 16
8 1,1,3,5,1,7 6

The cycle always end on the pair (1,n-1), as it's the only pair which can precede the pair (1,1).

Expressions

  • The following equation applies:
L(n)=2L(n1)L(n3)

Template:Math proof

Relation to Fibonacci numbers

The Leonardo numbers are related to the Fibonacci numbers by the relation L(n)=2F(n+1)1,n0.

From this relation it is straightforward to derive a closed-form expression for the Leonardo numbers, analogous to Binet's formula for the Fibonacci numbers:

L(n)=2φn+1ψn+1φψ1=25(φn+1ψn+1)1=2F(n+1)1

where the golden ratio φ=(1+5)/2 and ψ=(15)/2 are the roots of the quadratic polynomial x2x1=0.

References

Template:Reflist

Template:Classes of natural numbers