Lucas (n-ésimo)
- Created by
- Renato Passos, Eng. de Software
- Reviewed by
- Renato Passos, Eng. de Software
Last updated: Apr 18, 2026
Formula
recorrência Lucas
About this calculator
The Lucas (nth) calculator generates the nth number of the Lucas sequence, a numerical series defined by recurrence: L_n = L_{n-1} + L_{n-2}, with initial values L_0 = 2 and L_1 = 1. Like the Fibonacci sequence, Lucas numbers are sums of the two previous terms, but they start from different seeds. The calculator allows you to enter an index n (usually non-negative) and obtain the corresponding term, making it easy to study and apply this sequence.
The calculation is done iteratively, starting from the first two terms and applying the recurrence until reaching the desired index. For n = 0, the result is 2; for n = 1, it is 1; for n > 1, the system sums the two previous terms successively. This approach is simple and avoids closed-form formulas, being ideal for understanding the behavior of the sequence. The calculator is useful for mathematics students, programmers working with recursion, and enthusiasts of numerical sequences.
Use this tool when you need a specific term of the Lucas sequence to solve number theory problems, such as in primality tests (e.g., the Lucas-Lehmer test) or in mathematical patterns. It is also useful in computational algorithms that explore properties of numbers. Be careful with very large indices, as the numbers grow quickly; the calculator may have precision limitations for n above 70 or 80, depending on the implementation. For high values, consider using arbitrary-precision libraries.
The Lucas sequence has interesting properties, such as its relationship with the golden ratio (phi) and the Fibonacci sequence. For example, L_n = phi^n + (-phi)^(-n) for integer n. The calculator helps explore these connections, but remember that the recurrence is the most direct way to obtain the terms. Avoid confusing it with the Fibonacci sequence; although both follow the same recurrence, different initial values generate distinct numbers. For instance, L_2 = 3, while F_2 = 1.
Frequently asked questions
What is the difference between the Lucas sequence and the Fibonacci sequence?
Both follow the same recurrence (sum of the two previous terms), but start from different initial values: Fibonacci starts with F_0=0 and F_1=1, while Lucas starts with L_0=2 and L_1=1. This generates distinct sequences.
Can I use the calculator for negative numbers?
The Lucas sequence can be extended to negative indices using the reverse recurrence, but this calculator focuses on non-negative n. For negative values, consult a mathematical reference.
Up to what n is the calculator accurate?
Accuracy depends on the implementation. In JavaScript, integers are precise up to 2^53, which corresponds to approximately L_78. Above that, rounding may occur.
What is the practical use of Lucas numbers?
They are used in primality tests (such as the Lucas-Lehmer test for Mersenne numbers), cryptography, and number theory problems. They also appear in natural patterns.
How can I calculate L_n without the calculator?
You can use the closed-form formula: L_n = phi^n + (-phi)^(-n), where phi is the golden ratio (1.618...). For large n, the second term tends to zero, and L_n approaches phi^n.