lucas primality test small primes
Clash Royale CLAN TAG#URR8PPP
up vote
-1
down vote
favorite
I'm writing a a Lucas primality test using the Selfridge parameters, but it seems to indicate that 5 and 11 are not prime. For both of those, the Jacobi number is 0.
In the case of 5, the first Jacobi test you try is (5/5) = 0, so you stop and return composite.
In the case of 11, you do (5/11) = 1, (-7/11) = 1, (9/11) = 1, (-11/11) = 0.
I found no other examples so far where my test returns it's composite while it's prime.
They both stop when |D| = n. I can't find any indication that I should stop searching for D when D reaches some value, only that I should check that it's not a perfect square.
Is |D| = n some special case? Should I continue searching for D in that case? At least 5 and 11 will find -1 for the Jacobi symbol for the next value in the sequence.
primality-test
add a comment |Â
up vote
-1
down vote
favorite
I'm writing a a Lucas primality test using the Selfridge parameters, but it seems to indicate that 5 and 11 are not prime. For both of those, the Jacobi number is 0.
In the case of 5, the first Jacobi test you try is (5/5) = 0, so you stop and return composite.
In the case of 11, you do (5/11) = 1, (-7/11) = 1, (9/11) = 1, (-11/11) = 0.
I found no other examples so far where my test returns it's composite while it's prime.
They both stop when |D| = n. I can't find any indication that I should stop searching for D when D reaches some value, only that I should check that it's not a perfect square.
Is |D| = n some special case? Should I continue searching for D in that case? At least 5 and 11 will find -1 for the Jacobi symbol for the next value in the sequence.
primality-test
I added a "if (j != 1 && |D| != n) break" in my loop, meaning we want to stop searching if the Jacobi result is 0 or -1, but skip the case where the Jacobi test is not meaningful. Optionally I could skip the Jacobi test entirely but that's a dubious micro-optimization. Realistically this only happens for 5 and 11.
â DanaJ
2 days ago
add a comment |Â
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
I'm writing a a Lucas primality test using the Selfridge parameters, but it seems to indicate that 5 and 11 are not prime. For both of those, the Jacobi number is 0.
In the case of 5, the first Jacobi test you try is (5/5) = 0, so you stop and return composite.
In the case of 11, you do (5/11) = 1, (-7/11) = 1, (9/11) = 1, (-11/11) = 0.
I found no other examples so far where my test returns it's composite while it's prime.
They both stop when |D| = n. I can't find any indication that I should stop searching for D when D reaches some value, only that I should check that it's not a perfect square.
Is |D| = n some special case? Should I continue searching for D in that case? At least 5 and 11 will find -1 for the Jacobi symbol for the next value in the sequence.
primality-test
I'm writing a a Lucas primality test using the Selfridge parameters, but it seems to indicate that 5 and 11 are not prime. For both of those, the Jacobi number is 0.
In the case of 5, the first Jacobi test you try is (5/5) = 0, so you stop and return composite.
In the case of 11, you do (5/11) = 1, (-7/11) = 1, (9/11) = 1, (-11/11) = 0.
I found no other examples so far where my test returns it's composite while it's prime.
They both stop when |D| = n. I can't find any indication that I should stop searching for D when D reaches some value, only that I should check that it's not a perfect square.
Is |D| = n some special case? Should I continue searching for D in that case? At least 5 and 11 will find -1 for the Jacobi symbol for the next value in the sequence.
primality-test
asked Jul 30 at 4:44
Kurt Roeckx
1
1
I added a "if (j != 1 && |D| != n) break" in my loop, meaning we want to stop searching if the Jacobi result is 0 or -1, but skip the case where the Jacobi test is not meaningful. Optionally I could skip the Jacobi test entirely but that's a dubious micro-optimization. Realistically this only happens for 5 and 11.
â DanaJ
2 days ago
add a comment |Â
I added a "if (j != 1 && |D| != n) break" in my loop, meaning we want to stop searching if the Jacobi result is 0 or -1, but skip the case where the Jacobi test is not meaningful. Optionally I could skip the Jacobi test entirely but that's a dubious micro-optimization. Realistically this only happens for 5 and 11.
â DanaJ
2 days ago
I added a "if (j != 1 && |D| != n) break" in my loop, meaning we want to stop searching if the Jacobi result is 0 or -1, but skip the case where the Jacobi test is not meaningful. Optionally I could skip the Jacobi test entirely but that's a dubious micro-optimization. Realistically this only happens for 5 and 11.
â DanaJ
2 days ago
I added a "if (j != 1 && |D| != n) break" in my loop, meaning we want to stop searching if the Jacobi result is 0 or -1, but skip the case where the Jacobi test is not meaningful. Optionally I could skip the Jacobi test entirely but that's a dubious micro-optimization. Realistically this only happens for 5 and 11.
â DanaJ
2 days ago
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2866661%2flucas-primality-test-small-primes%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
I added a "if (j != 1 && |D| != n) break" in my loop, meaning we want to stop searching if the Jacobi result is 0 or -1, but skip the case where the Jacobi test is not meaningful. Optionally I could skip the Jacobi test entirely but that's a dubious micro-optimization. Realistically this only happens for 5 and 11.
â DanaJ
2 days ago