{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Example\n\nFix integers $P$ and $Q$.\nThe *Lucas sequences* $U_n(P, Q)$ and $V_n(P, Q)$ are the [[solutions|06MJC8YDYR]] of the recurrence\n$$x_{n+2} = P\\, x_{n+1} - Q\\, x_n \\qquad (n \\ge 0)$$\nwith initial values $U_0 = 0$, $U_1 = 1$ and $V_0 = 2$, $V_1 = P$.\nThe [[characteristic polynomial|0YA7X86K05]] is $X^2 - P X + Q$.\nIf its discriminant $D = P^2 - 4Q$ is not $0$, let $a, b$ be its two distinct complex roots; then\n$$U_n = \\frac{a^n - b^n}{a - b}, \\qquad V_n = a^n + b^n.$$\nCheck: both formulas solve the recurrence, since $a^{n+2} = P a^{n+1} - Q a^n$ and likewise for $b$, and they give $U_0 = 0$, $U_1 = 1$, $V_0 = 2$, $V_1 = a + b = P$.\n\nSpecial cases:\n\n1. $P = 1$, $Q = -1$: $U_n$ are the [[Fibonacci numbers|0GA9K57A39]] $0, 1, 1, 2, 3, 5, \\dots$ and $V_n$ are the Lucas numbers $2, 1, 3, 4, 7, 11, \\dots$.\n2. $P = 2$, $Q = -1$: $U_n$ are the [[Pell numbers|JY4ZN779YG]] $0, 1, 2, 5, 12, 29, \\dots$.\n3. $P = 3$, $Q = 2$: $U_n = 2^n - 1$, the Mersenne numbers $0, 1, 3, 7, 15, \\dots$, since the roots are $2$ and $1$.\n\n## Explanations\n\n### L1 human\n\nA Lucas sequence is a two-parameter family that contains the Fibonacci numbers and many of their relatives.\nEach term is $P$ times the previous term minus $Q$ times the one before.\nChanging $P$ and $Q$ gives the Fibonacci numbers, the Pell numbers, or the numbers $2^n - 1$.\nBecause they share one formula, facts proved once for Lucas sequences hold for all of these at the same time.\nThey are used in primality tests, for example the [[Lucas–Lehmer test|061BTYA0RN]] for [[Mersenne primes|0F3Z22M2GT]].\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "instance_of": [
      "06MJC8YDYR"
    ],
    "kind": "example",
    "msc": [
      "11B39",
      "39A06"
    ],
    "name": "Lucas sequence",
    "same_as": {
      "wikidata": "Q1759646",
      "wikipedia": "Lucas sequence"
    },
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Lucas_sequence"
      }
    ],
    "tag": "DP39F5KQ2W"
  },
  "kind": "example",
  "link": "https://tamnd.github.io/math2/node/DP39F5KQ2W/",
  "links": [
    {
      "field": "instance_of",
      "target": "06MJC8YDYR"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/DP39F5KQ2W.md",
  "msc": [
    "11B39",
    "39A06"
  ],
  "name": "Lucas sequence",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/DP3/DP39F5KQ2W.md",
  "status": null,
  "tag": "DP39F5KQ2W",
  "uri": "m2://DP39F5KQ2W",
  "url": "https://tamnd.github.io/math2/wiki/lucas-sequence/",
  "writing": {
    "tag": "DP39F5KQ2W",
    "kind": "example",
    "level": "W0",
    "next": [
      {
        "what": "a source with a locator",
        "have": 0,
        "want": 1
      }
    ]
  }
}
