lucas primality test small primes

The name of the pictureThe name of the pictureThe name of the pictureClash 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.







share|cite|improve this question



















  • 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














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.







share|cite|improve this question



















  • 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












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.







share|cite|improve this question











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.









share|cite|improve this question










share|cite|improve this question




share|cite|improve this question









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
















  • 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















active

oldest

votes











Your Answer




StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
);
);
, "mathjax-editing");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "69"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















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



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes










 

draft saved


draft discarded


























 


draft saved


draft discarded














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













































































Comments

Popular posts from this blog

What is the equation of a 3D cone with generalised tilt?

Relationship between determinant of matrix and determinant of adjoint?

Color the edges and diagonals of a regular polygon