Lucas Sequence Calculator

U_n(P,Q) & V_n(P,Q)

CalculatorsFreeNo Signup
4.7(140 reviews)
All Tools

Loading tool...

About Lucas Sequence Calculator

A Lucas sequence calculator computing U_n(P,Q) and V_n(P,Q) with recurrence x_n = P·x_{n-1} − Q·x_{n-2}. Fibonacci=U_n(1,−1), Lucas=V_n(1,−1). Shows both sequences, discriminant, and special cases. Client-side.

Lucas Sequence Calculator Features

  • U_n and V_n
  • Custom P,Q
  • Special cases
  • Discriminant
  • Identities
Lucas sequences: U_n(P,Q) and V_n(P,Q) satisfy x_n=Px_{n-1}−Qx_{n-2}. U: initial U_0=0, U_1=1. V: initial V_0=2, V_1=P. Fibonacci=U_n(1,−1). Pell=U_n(2,−1). Chebyshev polynomials are related. Foundation of primality testing.

How to Use

Enter P, Q, and n:

  • U_n: First kind
  • V_n: Second kind
  • Sequences: Both displayed

Special Cases

P=1,Q=−1: Fibonacci/Lucas. P=2,Q=−1: Pell/Companion Pell. P=2,Q=1: trivial (U_n=n, V_n=2). P=1,Q=2: alternating. The discriminant D=P²−4Q determines the character of the sequences.

Primality Testing

Lucas primality test: if n has no factor ≤√n, and for some D, U_{n+1}≡0 (mod n) while U_{(n+1)/q}≢0 for all prime factors q of n+1, then n is prime. This generalizes Pocklington's test.

Step-by-Step Instructions

  1. 1Enter P and Q.
  2. 2Enter n.
  3. 3Compute U_n.
  4. 4Compute V_n.
  5. 5Check identities.

Lucas Sequence Calculator — Frequently Asked Questions

What's the discriminant D=P²−4Q?+

D determines the 'type' of sequence. D>0: exponential growth (like Fibonacci). D=0: polynomial growth. D<0: bounded/oscillating. The characteristic roots are (P±√D)/2. These are eigenvalues of the companion matrix.

How are Lucas sequences used in primality testing?+

The Lucas-Lehmer test (for Mersenne primes) uses V_n. The Baillie-PSW test combines Miller-Rabin with a Lucas test — no pseudoprimes are known! Lucas sequences provide a complementary primality criterion to Fermat-based tests.

What identities hold?+

U_{m+n}=U_m·V_n−Q^n·U_{m-n}. V_n²−D·U_n²=4Q^n. U_{2n}=U_n·V_n. V_{2n}=V_n²−2Q^n. These 'doubling formulas' enable O(log n) computation via matrix exponentiation.

Share this tool: