Lucas prime checker
Enter an index and see whether the Lucas number at that position is prime: L(5) is 11, a two-digit prime, while L(6) is 18 and composite. Each value is built exactly from 2, 1, 3, 4, 7… Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- N
- 5
- Lucas
- 11
- Lucas digits
- 2
Lucas numbers form the companion sequence to the Fibonacci numbers: L(0) equals 2, L(1) equals 1, and each later term is the sum of the previous two, so the sequence begins 2, 1, 3, 4, 7, 11, 18, 29, 47, and so on. A Lucas prime is simply a Lucas number that is also a prime integer—classic examples are L(0)=2, L(2)=3, L(4)=7, L(5)=11, L(7)=29, and L(8)=47, while L(1)=1 and L(3)=4 are not prime.
What Lucas numbers are and when L(n) can be prime
The Lucas sequence shares the Fibonacci recurrence but starts from a different pair of seeds. With L(0)=2 and L(1)=1, every later term satisfies L(n)=L(n-1)+L(n-2). A Lucas prime is a term L(n) that is a prime number in the ordinary sense: greater than one with no positive divisors other than one and itself.
Small indices already illustrate the distinction: L(0)=2 is prime, L(1)=1 is not prime by definition, L(2)=3 and L(4)=7 and L(5)=11 are prime, while L(3)=4 and L(6)=18 are composite. Number theorists study which indices n can produce a prime L(n); many composite indices force algebraic factorizations of L(n), so the search for large Lucas primes focuses on carefully chosen n.
Where a Lucas prime checker fits real workflows
Teachers and olympiad coaches use a Lucas prime checker to verify student tables of L(n), to generate counter-examples where the recurrence produces a composite, and to contrast Lucas primes with Fibonacci primes in the same lesson. Puzzle and recreational-math generators filter candidate seeds so only indices whose Lucas value is prime enter a level table—a stricter and more distinctive gate than a plain is-prime check on arbitrary integers.
Prefer this capability when the search intent or product rule is specifically primality of L(n)—not when you only need a general prime test of an arbitrary integer, not when you need the Lucas–Lehmer test for Mersenne numbers 2^p−1, and not when you need Lucas’s theorem for binomial coefficients modulo a prime.
What you can do with it
Puzzle and level seed filters
Accept only indices n where L(n) is prime so game seeds follow a distinctive Lucas-prime sequence rather than arbitrary primes.
Small-table baseline for research notes
Confirm L(n) and primality for n up to a few hundred before launching heavier searches or CAS scripts for larger Lucas primes.
FAQ
What is a Lucas prime?
A Lucas number L(n) that is also a prime integer. For example L(0)=2, L(2)=3, L(4)=7, and L(5)=11 are Lucas primes; L(1)=1 and L(3)=4 are not.
How is L(n) defined here?
L(0)=2, L(1)=1, and L(n)=L(n−1)+L(n−2) for n≥2. The same recurrence as Fibonacci, with different starting values.
Which Lucas numbers are prime?
Among the first terms, L(0)=2, L(2)=3, L(4)=7, L(5)=11, L(7)=29 and L(8)=47 are prime. L(1)=1 is not prime by definition, and L(3)=4 and L(6)=18 are composite.
What does the result show for index 5?
It shows that L(5) = 11, notes that the value has 2 digits and confirms that it is prime. You get the full Lucas number, not just a yes or no, so you can compare it with your own table.
How large an index can I check?
Any whole index from 0 through 200. Negative indices are refused, because Lucas numbers are not defined here for them. Within that range the value is built exactly before it is tested.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/numth/lucas-prime \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"n":5}'const res = await fetch("https://api.kit.forhosting.com/numth/lucas-prime", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"n": 5
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/numth/lucas-prime",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"n": 5
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/numth/lucas-prime", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"n":5}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"n":5}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/numth/lucas-prime", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"n": 5
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "numth.lucas_prime",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
This Lucas prime checker accepts a single non-negative integer index n, computes L(n) with exact BigInt arithmetic, runs a deterministic trial-division primality test, and returns the value, its digit count, and a clear is_prime flag. The same pure algorithm runs free in the browser and on the API, so homework checks and automation never disagree. Negative indices are rejected with invalid_input before any computation runs.
What Lucas numbers are and when L(n) can be prime
This capability does not assume those deep divisibility theorems up front—it always builds L(n) exactly and tests the value—so the answer stays correct even for edge cases such as n=0 or n=1, and the returned lucas field is the number a student would write by hand when expanding the recurrence. That transparency matters in classrooms and contest prep, where showing the intermediate value is as important as the final yes-or-no flag.
Input contract, response fields, and error behaviour
Negative n is explicitly forbidden: the message states that n must be non-negative because this checker does not define Lucas numbers for negative indices. Example: n equals −3 fails with a non-negative requirement and is not billed. Keep n inside the supported bound so trial division of L(n) stays interactive even for the largest allowed indices. Send a JSON body with one required field n: a whole integer from zero through two hundred inclusive, accepted as a JSON number or as a decimal digit string with an optional leading plus sign. Fractions, booleans, empty strings, scientific notation, and values outside that range are rejected with invalid_input before any Lucas arithmetic runs. On success the response echoes n, returns lucas as a JSON number when L(n) fits in a safe integer and as a decimal string otherwise, reports lucas_digits as the count of decimal digits of the absolute value, and sets is_prime after deterministic trial division with a six-step wheel over BigInt. Example: n equals 5 yields lucas 11, lucas_digits 2, and is_prime true. Example: n equals 1 yields lucas 1 and is_prime false.
Where a Lucas prime checker fits real workflows
Research notebooks and contest platforms sometimes need a quick sanity check before launching a heavier search for large Lucas primes; running this endpoint for n up to a few hundred confirms the small-table baseline without standing up a computer-algebra system. Keep n a non-negative integer within the documented maximum, treat invalid_input as a client fix rather than a retry, store both lucas and is_prime if you need an audit trail, and you get reproducible Lucas-prime decisions for LMS plugins, notebooks, and edge workers at a transparent $0.002 on the API path.
Integration use cases
Homework and contest verification
Check student lists of Lucas numbers and whether each L(n) is prime; show the exact value beside the is_prime flag for grading.
Technical questions
Which inputs are accepted?
Whole integers n from 0 through 200. Negative n, fractions, booleans, and non-numeric strings return invalid_input.
What does the response include?
n, lucas (the value of L(n) as a number or decimal string), lucas_digits, and is_prime (true only when L(n) is prime).
What does the Lucas prime checker cost?
The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.