This question is successor of Primality test for numbers of the form (11^p−1)/10
Here is what I observed:
For $(10^p-1)/9$ :
Let $N$ = $(10^p-1)/9$ when $p$ is a prime number $p > 3$.
Let the sequence $S_i=S_{i-1}^{10}-10 S_{i-1}^8+35 S_{i-1}^6-50 S_{i-1}^4+25 S_{i-1}^2-2$ with $S_0=123$. Then $N$ is prime if and only if $S_{p-1} \equiv S_{0}\pmod{N}$.
I choose $123$ because this is the $10_{th}$ Lucas number $L_{10}$.
For the sequence, I choose the Lucas' polynomial $L_{10}(x)$ and alternate $+$ and $-$ for each part as shown in the sequence. (I don't know if these polynomials have a name).
For the test I use PARI/GP.
For example with $p = 19$ I found with PARI/GP:
Mod(123, 1111111111111111111)
Mod(959728737261142095, 1111111111111111111)
Mod(1087997224047968198, 1111111111111111111)
Mod(1083348694997563282, 1111111111111111111)
Mod(1039950736755546285, 1111111111111111111)
Mod(182325812441571117, 1111111111111111111)
Mod(579459289893901100, 1111111111111111111)
Mod(1068377107457264504, 1111111111111111111)
Mod(515160075503304980, 1111111111111111111)
Mod(429948940599801490, 1111111111111111111)
Mod(986618928768148932, 1111111111111111111)
Mod(588443728549357779, 1111111111111111111)
Mod(1031474122141075375, 1111111111111111111)
Mod(567090245602400840, 1111111111111111111)
Mod(76640950307142886, 1111111111111111111)
Mod(924987104665055322, 1111111111111111111)
Mod(374008108546502807, 1111111111111111111)
Mod(143266707375326409, 1111111111111111111)
Mod(123, 1111111111111111111)
And $1111111111111111111$ is indeed a prime number.
For $((10 \cdot 2^n)^p-1)/(10 \cdot 2^n-1)$ :
I tested some extensions with $(20^p-1)/19, (40^p-1)/39$ and $(80^p-1)/79$ and it seems the primality test works for example where $S_0=15127$, the $20_{th}$ Lucas number with the Lucas polynomial $L_{20}(x)$ still with $+$ and $-$ alternated.
Globally $L_{10 \cdot 2^n}$ for Lucas number and $L_{10 \cdot 2^n}(x)$ for Lucas polynomials with $+$ and $-$ alternated.
Is there a way to explain this? I try to prove it by myself but it's not easy. If you found a counterexample please tell me.
It generally works with most primes, I've thrown this sort of test (in a more refined form) at literally millions of numbers.
You could look at http://www.os2fan2.com/gloss/maths.pdf where I give a working function to deal with this sort of problem.
The Messerine test amounts to that if $p = 7\pmod{24}$, then
isoquad(4,(p+1)/4, 2, 4)=0makespprime. A run over the first million cases produced only a handful of fails. If p+1 = 2^x.(odd), and 2^x > odd, then this is sufficient proof that p is prime.The messerine test in the form above depends on that the prime is upper-long, ie the period divides p+1 an odd number of times. A result of 0 equates to a quarter-period.
The particular test that you are running will of course demonstrate that if p is prime, it will divide either S(p+1)-2 or S(p-1)-2, and that the value at p is adjacent to both sides of the value it divides (ie upper vs lower).
The thing is somewhat more robust than the small fermat theorom, which states that if p is prime, then p | (b^(p-1)-1. This is because this class of bases equates to that p | (b^p-1)-2 or p | b^(p+1)-2, and it is harder to create a composite number that divides both these values (p-1, p+1).
For example, 1729 is a pseudoprime to every base. It has three divisors, 7, 13, and 19, with individual periods of 6, 12, 18. This means that 1/1729 in any base has a period that divides 36, and 36 divides 1728. So b^1728-1 is a multiple of 1729.
A number like 341 is a pseudoprime to 2, in that 341 | 2^340 - 1, but 341 = 11 *31. In base 2, 341 has a 10-digit period, and 10 A 341.