Lucky Number Checker
Test membership in the lucky-number sieve that starts with positive odd integers and repeatedly removes every kth survivor; input is capped at 100,000.
Description
Lucky numbers survive a positional sieve: after removing even numbers, each next surviving step removes every kth current survivor.
Lucky numbers survive a positional sieve: after removing even numbers, each next surviving step removes every kth current survivor. This differs from removing numeric multiples of primes.1
The tool returns isLucky. The indexing and output conventions below determine how to read these values.
When to use Lucky Number Checker
Use this for the following task: Test membership in the lucky-number sieve that starts with positive odd integers and repeatedly removes every kth survivor; input is capped at 100,000. Use the input and output conventions below to reproduce the intended mathematical quantity.
How to use Lucky Number Checker and understand its results
- Choose the required indexes, integers or sequence entries. Preserve decimal-string encodings where the field table specifies strings.
- Enter n according to the field table, then run the tool.
- Read isLucky. A true flag means the candidate meets the stated property; false means it does not.
- If the flag is false, review the candidate and definition. A well-formed nonmember is different from a rejected input.
| Input field | Meaning | Value type and bounds | Requirement |
|---|---|---|---|
| n | Nonnegative integer (sieve resource limit 100000) | integer; minimum 0; maximum 100000 | Required |
Exclude zero and even n. Build odd survivors through n, repeatedly filter one-based positions using the next surviving step, then test whether n remains.
start with positive odds; for successive surviving k, remove positions divisible by k The symbols and boundary conditions refer to the supplied fields and the implementation described above.
| Output field | Meaning | Value type |
|---|---|---|
| isLucky | Whether n survives the lucky-number sieve | boolean |
{
"input": {
"n": 21
},
"output": {
"isLucky": true
}
} Limitations and assumptions
The candidate is at most 100000. This tests lucky-sieve membership without any probabilistic luck, prime property or generated lucky-number list.
Use the declared integer bounds and string formats. Large exact outputs remain decimal strings; numerical approximations use ordinary floating-point arithmetic. A rejected input is different from a valid zero count or false membership flag.
Alternative or Complementary methods
Choose Prime Counting by the Sieve of Eratosthenes when you need its operation: Count primes at most n exactly with the sieve of Eratosthenes, excluding zero and one and limiting n to 1,000,000. Choose Recamán Sequence Term for the complementary operation: Return a(0)=0 and a(n)=a(n−1)−n when that value is positive and unused, otherwise a(n−1)+n; the index is capped at 100,000.
Background reference: OEIS A000959.
References
-
OEIS A000959 — OEIS Foundation
Similar or alternative tools
- Prime Counting by the Sieve of Eratosthenes
Count primes at most n exactly with the sieve of Eratosthenes, excluding zero and one and limiting n to 1,000,000.
- Recamán Sequence Term
Return a(0)=0 and a(n)=a(n−1)−n when that value is positive and unused, otherwise a(n−1)+n; the index is capped at 100,000.