Efficient way to find primitive root without prime factorization











up vote
1
down vote

favorite
1












I was wondering if there is a more efficient brute-forcing approach to find any primitive root of number $p$ without prime factorization.



My approach is as follows:




  1. Get a random residue class $[x]$ smaller than $p$.

  2. Set exponent to $1$.

  3. Calculate result = [x]^exponent mod p.

  4. Check if result is $1$.

  5. If result is $1$, check if exponent is $p-1$.

  6. If condition 5 is true, we have found a primitive root.

  7. If condition 5 is not true, we get a new random residue class $[x]$ smaller than $p$.

  8. In each iteration, increase exponent by $1$.










share|cite|improve this question
























  • By the way: you could at least stop your algorithm at $(p-1)/2$. If $x$ is not a primitive root modulo $p$, its order in $left(Bbb{Z}/pBbb{Z}right)^times$ is guaranteed to be a proper divisor of $p-1$.
    – A.P.
    Oct 26 '15 at 9:24










  • From these answers it looks like you are out of luck.
    – A.P.
    Oct 26 '15 at 9:44















up vote
1
down vote

favorite
1












I was wondering if there is a more efficient brute-forcing approach to find any primitive root of number $p$ without prime factorization.



My approach is as follows:




  1. Get a random residue class $[x]$ smaller than $p$.

  2. Set exponent to $1$.

  3. Calculate result = [x]^exponent mod p.

  4. Check if result is $1$.

  5. If result is $1$, check if exponent is $p-1$.

  6. If condition 5 is true, we have found a primitive root.

  7. If condition 5 is not true, we get a new random residue class $[x]$ smaller than $p$.

  8. In each iteration, increase exponent by $1$.










share|cite|improve this question
























  • By the way: you could at least stop your algorithm at $(p-1)/2$. If $x$ is not a primitive root modulo $p$, its order in $left(Bbb{Z}/pBbb{Z}right)^times$ is guaranteed to be a proper divisor of $p-1$.
    – A.P.
    Oct 26 '15 at 9:24










  • From these answers it looks like you are out of luck.
    – A.P.
    Oct 26 '15 at 9:44













up vote
1
down vote

favorite
1









up vote
1
down vote

favorite
1






1





I was wondering if there is a more efficient brute-forcing approach to find any primitive root of number $p$ without prime factorization.



My approach is as follows:




  1. Get a random residue class $[x]$ smaller than $p$.

  2. Set exponent to $1$.

  3. Calculate result = [x]^exponent mod p.

  4. Check if result is $1$.

  5. If result is $1$, check if exponent is $p-1$.

  6. If condition 5 is true, we have found a primitive root.

  7. If condition 5 is not true, we get a new random residue class $[x]$ smaller than $p$.

  8. In each iteration, increase exponent by $1$.










share|cite|improve this question















I was wondering if there is a more efficient brute-forcing approach to find any primitive root of number $p$ without prime factorization.



My approach is as follows:




  1. Get a random residue class $[x]$ smaller than $p$.

  2. Set exponent to $1$.

  3. Calculate result = [x]^exponent mod p.

  4. Check if result is $1$.

  5. If result is $1$, check if exponent is $p-1$.

  6. If condition 5 is true, we have found a primitive root.

  7. If condition 5 is not true, we get a new random residue class $[x]$ smaller than $p$.

  8. In each iteration, increase exponent by $1$.







algorithms prime-numbers exponentiation prime-factorization primitive-roots






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Nov 23 at 11:21









Klangen

1,25811129




1,25811129










asked Oct 26 '15 at 8:35









Pierre

61




61












  • By the way: you could at least stop your algorithm at $(p-1)/2$. If $x$ is not a primitive root modulo $p$, its order in $left(Bbb{Z}/pBbb{Z}right)^times$ is guaranteed to be a proper divisor of $p-1$.
    – A.P.
    Oct 26 '15 at 9:24










  • From these answers it looks like you are out of luck.
    – A.P.
    Oct 26 '15 at 9:44


















  • By the way: you could at least stop your algorithm at $(p-1)/2$. If $x$ is not a primitive root modulo $p$, its order in $left(Bbb{Z}/pBbb{Z}right)^times$ is guaranteed to be a proper divisor of $p-1$.
    – A.P.
    Oct 26 '15 at 9:24










  • From these answers it looks like you are out of luck.
    – A.P.
    Oct 26 '15 at 9:44
















By the way: you could at least stop your algorithm at $(p-1)/2$. If $x$ is not a primitive root modulo $p$, its order in $left(Bbb{Z}/pBbb{Z}right)^times$ is guaranteed to be a proper divisor of $p-1$.
– A.P.
Oct 26 '15 at 9:24




By the way: you could at least stop your algorithm at $(p-1)/2$. If $x$ is not a primitive root modulo $p$, its order in $left(Bbb{Z}/pBbb{Z}right)^times$ is guaranteed to be a proper divisor of $p-1$.
– A.P.
Oct 26 '15 at 9:24












From these answers it looks like you are out of luck.
– A.P.
Oct 26 '15 at 9:44




From these answers it looks like you are out of luck.
– A.P.
Oct 26 '15 at 9:44















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: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
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%2f1498166%2fefficient-way-to-find-primitive-root-without-prime-factorization%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Mathematics Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f1498166%2fefficient-way-to-find-primitive-root-without-prime-factorization%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Wiesbaden

Marschland

Dieringhausen