The sequence
OEIS A400659:
In the notation of the paper, where
How each term is proved
Write
-
Every smaller exponent is composite. For each
, either a prime with and is found, or a base with and is exhibited. No prime satisfies the second condition either, so is composite. (For , is not prime by definition.) -
is prime, by the Lucas test. It applies because is completely factored: its prime factors are the first primes.
The Lucas
where
Check it yourself
Two self-contained programs re-prove every term on your own computer. Neither needs any data from this site:
- A400659.gp, for PARI/GP;
- A400659.py, for Python.
For each
gp -q A400659.gp
python A400659.py
The last line of the output is
OK: a(1)..a(100) proved and equal to the b-file. Total 184 s.
Times measured on one core of a desktop PC: PARI/GP 2.17.3, 184 s; Python 3.13 with gmpy2, 119 s; Python 3.13 with the standard library only, 1,017 s (Python's built-in integers multiply large numbers about ten times more slowly than the GMP library behind PARI and gmpy2). Most of it is the last
term:
n=1 a(n)=2 digits=1 k=1 gives N=1 (not prime) | k=2 prime: Lucas N+1, D=5, P=1 [0 ms]
n=2 a(n)=1 digits=1 no smaller k | k=1 prime: Lucas N+1, D=-7, P=1 [0 ms]
n=4 a(n)=3 digits=5 k<3 composite (2 with a prime factor below 10^5) | k=3 prime: Lucas N+1, D=-7, P=1, except (q,P)=[[2, 7]] [0 ms]
n=26 a(n)=65 digits=167 k<65 composite (38 with a prime factor below 10^5, 26 by a Fermat test, bases [2]) | k=65 prime: Lucas N+1, D=-7, P=1, except (q,P)=[[83, 9]] [47 ms]
n=100 a(n)=1279 digits=3713 k<1279 composite (543 with a prime factor below 10^5, 735 by a Fermat test, bases [2]) | k=1279 prime: Lucas N+1, D=-7, P=1, except (q,P)=[[2, 7]] [141891 ms]
The two programs were written independently: separate prime tables, small-factor
tests, Jacobi symbols and arithmetic in the quadratic ring. They use the same search order for
Shorter runs. python A400659.py 30 checks
verify(); and quit;), load it with
\r A400659.gp and call verify(30). Also in gp,
crossCheck(1, 60) re-proves the primes at isprime, which shares nothing with the Lucas
Stack size. The gp program raises PARI's stack limit itself
(parisizemax, 1 GB). The one-line program in the OEIS entry needs the
same setting for larger isprime
stops with “the PARI stack overflows” at default(parisizemax, 2^30) first.
Requirements. PARI/GP 2.13 or later, or Python 3.8 or later.
The Python program uses only the standard library; if the optional
gmpy2 package is installed it runs faster. Both are free software.
Scope
The terms