Skip to content

LucasL ​

The nth Lucas number: the Fibonacci-style recurrence started from L0=2L_0 = 2, L1=1L_1 = 1, closely related to Fibonacci.

✓ checked against that system · ! checked, with disagreements (hover a chip)WikipediaLucas numberMathWorldLucasNumberWikidataQ2503280OEISA000032Wolfram LanguageLucasL✓
LucasL(n)the nth Lucas number LnL_n.
SageMathlucas_number2(n, 1, -1)✓SymPylucas(n)JuliaCombinatorics.lucasnum(n)
LucasL(nu)a real (non-integer) index via Binet's formula, Lν=φν+cos⁡(πν)φ−νL_\nu = \varphi^\nu + \cos(\pi\nu)\varphi^{-\nu}.
SageMathlucas_number2(nu, 1, -1)✓SymPylucas(nu)JuliaCombinatorics.lucasnum(nu)
LucasL(n, x)the Lucas polynomial Ln(x)L_n(x), from Ln(x)=xLn−1(x)+Ln−2(x)L_n(x) = xL_{n-1}(x) + L_{n-2}(x) with L0(x)=2L_0(x) = 2, L1(x)=xL_1(x) = x, exact for a nonnegative integer n.
Typed signatures
TypePackageApplies
(integer) -> integercompute-enginealways
(number, any?) -> anynumber-theoryreplaces compute-enginealways
(value) -> valueadelesreplaces number-theoryon ProfiniteNumber

Domain: Sequences

Details
  • Defined by the same recurrence as Fibonacci, Ln=Ln−1+Ln−2L_n = L_{n-1} + L_{n-2}, but started from L0=2L_0 = 2, L1=1L_1 = 1.
  • Closed form: Ln=φn+ψnL_n = \varphi^n + \psi^n, where φ=1+52\varphi = \frac{1+\sqrt5}{2} and ψ=1−52\psi = \frac{1-\sqrt5}{2}.
  • Related to Fibonacci by Ln=Fn−1+Fn+1L_n = F_{n-1} + F_{n+1} and, conversely, Fn=Ln−1+Ln+15F_n = \dfrac{L_{n-1} + L_{n+1}}{5}.
  • Consecutive ratios Ln+1/LnL_{n+1}/L_n converge to the golden ratio, just as they do for Fibonacci.
  • Extends to negative n via L−n=(−1)nLnL_{-n} = (-1)^n L_n.
  • A list of indices is threaded over element-wise; a real (non-integer) index evaluates numerically via Binet's formula, and a symbolic second argument gives the Lucas polynomial.

Examples

Basic #
live ↗
InLucasL(0)\mathrm{LucasL}(0)Out22
live ↗
InLucasL(1)\mathrm{LucasL}(1)Out11
live ↗
InLucasL(5)\mathrm{LucasL}(5)Out1111
live ↗
InLucasL(10)\mathrm{LucasL}(10)Out123123
live ↗
InSeries⁡(LucasL(12,x),x,0,5)\operatorname{Series}(\mathrm{LucasL}(\frac{1}{2}, x), x, 0, 5)OutLucasL(12,0)+xLucasL(0,1)(12,0)+12LucasL(0,2)(12,0)x2+16LucasL(0,3)(12,0)x3+124LucasL(0,4)(12,0)x4+1120LucasL(0,5)(12,0)x5+O(x6)\mathrm{LucasL}(\frac{1}{2}, 0)+x\mathrm{LucasL}^{(0, 1)}(\frac{1}{2}, 0)+\frac{1}{2}\mathrm{LucasL}^{(0, 2)}(\frac{1}{2}, 0)x^2+\frac{1}{6}\mathrm{LucasL}^{(0, 3)}(\frac{1}{2}, 0)x^3+\frac{1}{24}\mathrm{LucasL}^{(0, 4)}(\frac{1}{2}, 0)x^4+\frac{1}{120}\mathrm{LucasL}^{(0, 5)}(\frac{1}{2}, 0)x^5+O\left(x^6\right)
Scope #

Exact at any size

live ↗
InLucasL(100)\mathrm{LucasL}(100)Out792 070 839 848 372 253 127792\,070\,839\,848\,372\,253\,127

An odd negative index flips the sign: L−11=−L11L_{-11} = -L_{11}

live ↗
InLucasL(−11)\mathrm{LucasL}(-11)Out−199-199

A real index uses Lν=φν+cos⁡(πν) φ−νL_\nu = \varphi^\nu + \cos(\pi\nu)\,\varphi^{-\nu}

live ↗
InLucasL(2.333 333 333 333 333 5)\mathrm{LucasL}(2.333\,333\,333\,333\,333\,5)Out3.236 211 879 491 621 33.236\,211\,879\,491\,621\,3

The two-argument Lucas polynomial L7(x)L_7(x), from Ln(x)=xLn−1(x)+Ln−2(x)L_n(x) = x L_{n-1}(x) + L_{n-2}(x)

live ↗
InLucasL(7,x)\mathrm{LucasL}(7, x)Outx7+7x5+14x3+7xx^7+7x^5+14x^3+7x

The Lucas polynomial at x=1x = 1 is the Lucas number: L143(1)=L143L_{143}(1) = L_{143}

live ↗
InLucasL(143,1)\mathrm{LucasL}(143, 1)Out767 772 505 664 398 093 937 756 525 279767\,772\,505\,664\,398\,093\,937\,756\,525\,279

Special value of the Lucas polynomial: L1(0)=0L_1(0) = 0

live ↗
InLucasL(1,0)\mathrm{LucasL}(1, 0)Out00

Special value of the Lucas polynomial: L0(0)=2L_0(0) = 2

live ↗
InLucasL(0,0)\mathrm{LucasL}(0, 0)Out22

L2(x)=x2+2L_2(x) = x^2 + 2 threads element-wise over a matrix argument

live ↗
InLucasL(2,[[12,−1],[0,12]])\mathrm{LucasL}(2, \bigl\lbrack\bigl\lbrack\frac{1}{2}, -1\bigr\rbrack, \bigl\lbrack0, \frac{1}{2}\bigr\rbrack\bigr\rbrack)Out[[94,3],[2,94]]\bigl\lbrack\bigl\lbrack\frac{9}{4}, 3\bigr\rbrack, \bigl\lbrack2, \frac{9}{4}\bigr\rbrack\bigr\rbrack

Threads element-wise over a list, as Wolfram's Listable heads do

live ↗
InLucasL([1,2,3,4])\mathrm{LucasL}(\bigl\lbrack1, 2, 3, 4\bigr\rbrack)Out[1,3,4,7]\bigl\lbrack1, 3, 4, 7\bigr\rbrack

Lucas numbers extend to rational index; 50-digit evaluation

live ↗
InN(LucasL(113),50)N(\mathrm{LucasL}(\frac{11}{3}), 50)Out5.923 962 652 961 955 410 135 697 862 194 012 628 751 985 542 236 25.923\,962\,652\,961\,955\,410\,135\,697\,862\,194\,012\,628\,751\,985\,542\,236\,2

Complex index gives a complex value

live ↗
InN(LucasL(1+12i))N(\mathrm{LucasL}(1+\frac{1}{2}i))Out0.065 338 425 470 823 424 320 359 862 424 055 077 050 251 860 953 103 4+0.755 094 920 107 233 972 742 981 419 715 215 424 101 179 285 156 060 2i0.065\,338\,425\,470\,823\,424\,320\,359\,862\,424\,055\,077\,050\,251\,860\,953\,103\,4+0.755\,094\,920\,107\,233\,972\,742\,981\,419\,715\,215\,424\,101\,179\,285\,156\,060\,2i

The Lucas polynomial of odd index is an odd function of xx

live ↗
InLucasL(1,−x)=−LucasL(1,x)\mathrm{LucasL}(1, -x)=-\mathrm{LucasL}(1, x)OutTrue\mathrm{True}

Even index gives an even polynomial in xx

live ↗
InLucasL(2,−x)=LucasL(2,x)\mathrm{LucasL}(2, -x)=\mathrm{LucasL}(2, x)OutTrue\mathrm{True}

Threads over a list of indices

live ↗
InLucasL([1,2,3,4,5])\mathrm{LucasL}(\bigl\lbrack1, 2, 3, 4, 5\bigr\rbrack)Out[1,3,4,7,11]\bigl\lbrack1, 3, 4, 7, 11\bigr\rbrack

Generating function 2−x1−x−x2\frac{2-x}{1-x-x^2}

live ↗
InGeneratingFunction(LucasL(n),n,x)\mathrm{GeneratingFunction}(\mathrm{LucasL}(n), n, x)Out2−x−x2−x+1\frac{2-x}{-x^2-x+1}

Real coefficients, so it commutes with complex conjugation

live ↗
InLucasL(1,z‾)=LucasL(1,z)‾\mathrm{LucasL}(1, \overline{z})=\overline{\mathrm{LucasL}(1, z)}OutTrue\mathrm{True}

Applied to a matrix as a function, here x2+2x^2+2 on an upper triangular matrix

live ↗
InFullSimplify(MatrixFunction(_1⁡↦LucasL(2,_1⁡),[[1/2,−1],[0,1/2]]))\mathrm{FullSimplify}(\mathrm{MatrixFunction}(\operatorname{\_1}↦\mathrm{LucasL}(2, \operatorname{\_1}), \bigl\lbrack\bigl\lbrack1/2, -1\bigr\rbrack, \bigl\lbrack0, 1/2\bigr\rbrack\bigr\rbrack))Out[[94,−1],[0,94]]\bigl\lbrack\bigl\lbrack\frac{9}{4}, -1\bigr\rbrack, \bigl\lbrack0, \frac{9}{4}\bigr\rbrack\bigr\rbrack
Applications #

Consecutive ratios Ln+1/LnL_{n+1}/L_n converge to the golden ratio too. See Fibonacci

live ↗
InLucasL(15)LucasL(14)\frac{\mathrm{LucasL}(15)}{\mathrm{LucasL}(14)}Out1 364843\frac{1\,364}{843}

First index whose Lucas number exceeds 10610^6

live ↗
InNestWhile(_1⁡↦_1⁡+1,1,_1⁡↦LucasL(_1⁡)≤106)\mathrm{NestWhile}(\operatorname{\_1}↦\operatorname{\_1}+1, 1, \operatorname{\_1}↦\mathrm{LucasL}(\operatorname{\_1})≤10^6)Out2929
Properties #

Ln2−5Fn2=4(−1)nL_n^2 - 5F_n^2 = 4(-1)^n, here at n=10n = 10. See Fibonacci

live ↗
InLucasL(10)2−5Fibonacci(10)2\mathrm{LucasL}(10)^2-5\mathrm{Fibonacci}(10)^2Out44

Ln=Fn−1+Fn+1L_n = F_{n-1} + F_{n+1}, here at n=6n = 6

live ↗
InLucasL(6)=Fibonacci(5)+Fibonacci(7)\mathrm{LucasL}(6)=\mathrm{Fibonacci}(5)+\mathrm{Fibonacci}(7)OutTrue\mathrm{True}

Conversely Fn=Ln−1+Ln+15F_n = \dfrac{L_{n-1} + L_{n+1}}{5}

live ↗
InFibonacci(6)=LucasL(5)+LucasL(7)5\mathrm{Fibonacci}(6)=\frac{\mathrm{LucasL}(5)+\mathrm{LucasL}(7)}{5}OutTrue\mathrm{True}

A Cassini-style identity Ln−1Ln+1−Ln2=5(−1)n+1L_{n-1}L_{n+1} - L_n^2 = 5(-1)^{n+1}, here at n=5n = 5

live ↗
InLucasL(4)LucasL(6)−LucasL(5)2\mathrm{LucasL}(4)\mathrm{LucasL}(6)-\mathrm{LucasL}(5)^2Out55

Negative indices are supported via L−n=(−1)nLnL_{-n} = (-1)^n L_n

live ↗
InLucasL(−1)\mathrm{LucasL}(-1)Out−1-1

L2=1+2L_2=1+2

live ↗
InLucasL(2)\mathrm{LucasL}(2)Out33

Known value · Wolfram MathematicalFunctionData, LucasL

Each term is the sum of the previous two

live ↗
InLucasL(3)\mathrm{LucasL}(3)Out44

Known value · Wolfram MathematicalFunctionData, LucasL

L4=3+4L_4=3+4

live ↗
InLucasL(4)\mathrm{LucasL}(4)Out77

Known value · Wolfram MathematicalFunctionData, LucasL

L6=7+11L_6=7+11

live ↗
InLucasL(6)\mathrm{LucasL}(6)Out1818

Known value · Wolfram MathematicalFunctionData, LucasL

L7=11+18L_7=11+18

live ↗
InLucasL(7)\mathrm{LucasL}(7)Out2929

Known value · Wolfram MathematicalFunctionData, LucasL

Lucas numbers grow by about the golden ratio each step

live ↗
InLucasL(8)\mathrm{LucasL}(8)Out4747

Known value · Wolfram MathematicalFunctionData, LucasL

L9=29+47L_9=29+47

live ↗
InLucasL(9)\mathrm{LucasL}(9)Out7676

Known value · Wolfram MathematicalFunctionData, LucasL

live ↗
In∑k=12(−1)kLucasL(k)LucasL(k+2)\sum_{k=1}^2\frac{(-1)^{k}}{\mathrm{LucasL}(k)\mathrm{LucasL}(k+2)}Out−1784-\frac{17}{84}

Known value · Wolfram MathematicalFunctionData, LucasL, FunctionalEquations

live ↗
InLucasL(2)2−LucasL(1)LucasL(3)\mathrm{LucasL}(2)^2-\mathrm{LucasL}(1)\mathrm{LucasL}(3)Out55

Known value · Wolfram MathematicalFunctionData, LucasL, FunctionalEquations

live ↗
In∑k=13(−1)kLucasL(k)LucasL(k+2)\sum_{k=1}^3\frac{(-1)^{k}}{\mathrm{LucasL}(k)\mathrm{LucasL}(k+2)}Out−52231-\frac{52}{231}

Known value · Wolfram MathematicalFunctionData, LucasL, FunctionalEquations

live ↗
InN(LucasL(1/2)2−LucasL(−12)LucasL(32))N(\mathrm{LucasL}(1/2)^2-\mathrm{LucasL}(-\frac{1}{2})\mathrm{LucasL}(\frac{3}{2}))Out−3.937 936 909 913 409 042 4⋅10−21-3.937\,936\,909\,913\,409\,042\,4\cdot10^{-21}

Known value · Wolfram MathematicalFunctionData, LucasL, FunctionalEquations

Neat examples #

L30L_{30} already tops 1.8 million, growing at the same rate as Fibonacci

live ↗
InLucasL(30)\mathrm{LucasL}(30)Out1 860 4981\,860\,498
About
Examples41
Checked againstWolfram Language 41 agreeSageMath 23 agree6 errorSymPy 25 agree1 differ3 unevaluatedmpmath 27 agreeJulia 21 agree6 error
CrosswalkWikipediaMathWorldWikidataOEISWolfram LanguageSageMathSymPyJulia

Implementation

mappedwolframpackages/oracle/src/mappings.ts
mappedsympypackages/oracle/src/mappings.ts
mappedsagepackages/oracle/src/mappings.ts
mappedjuliapackages/oracle/src/mappings.ts
mappedmpmathpackages/oracle/src/mappings.ts

F(n − 1) + F(n + 1): Lucas' number for integer n and its continuation otherwise.

See also: Fibonacci