Efficient algorithm to determine all numbers having a given totient value?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
3
down vote

favorite
1












A positive integer $kge 1$ is given. The object is to find all positive integers $n$ with $varphi(n)=k$




Is there an EFFICIENT algorithm to determine the set of numbers ?




It is clear that we can rule out prime factors $pge k+2$ and that we can also bound the exponents corresponding to all possible prime factors. But this brute force method is very slow. Is there a trick to get the set faster ? In particular nice would be an implementation in PARI/GP.



If I remember right, I asked a question about whether the set can be determined in a finite amount of time (which obviously is the case), but I am not sure whether I also asked for an efficient method. If so, I apologize for the duplicate.







share|cite|improve this question



















  • This is a nice question. I suspect the answer is "no". My next improvement for the brute force method would be to factor $k$ and collect those primes such that $p-1$ divides $k$. Such an approach does not lower the complexiity to below $O(k log k)$ though, which is quite slow.
    – davidlowryduda♦
    Jul 28 at 21:55










  • See mathoverflow.net/questions/31691/inverting-the-totient-function and math.stackexchange.com/a/23955/589
    – lhf
    Jul 28 at 22:30











  • Don't know whether this fits your "efficient"-requirement (likely not) but see Max Alexejev's implementation home.gwu.edu/~maxal/gpscripts
    – Gottfried Helms
    Jul 29 at 2:40










  • @GottfriedHelms I think in the meantime I have managed to implement an effective algorithm. I used the $p-1mid k$ - idea from above and additionaly, if we define $S$ to be the set of prime numbers satisfying $p-1mid k$ and $$P:=prod_pin S fracpp-1$$ we have the inequality $nle kP$ which accelerates the search significantically.
    – Peter
    Jul 29 at 12:11











  • Peter, why not putting this as an answer and close-the-case by "accepting" it?(Also I'm curious to see your formula more explicite :) )
    – Gottfried Helms
    Jul 30 at 15:12















up vote
3
down vote

favorite
1












A positive integer $kge 1$ is given. The object is to find all positive integers $n$ with $varphi(n)=k$




Is there an EFFICIENT algorithm to determine the set of numbers ?




It is clear that we can rule out prime factors $pge k+2$ and that we can also bound the exponents corresponding to all possible prime factors. But this brute force method is very slow. Is there a trick to get the set faster ? In particular nice would be an implementation in PARI/GP.



If I remember right, I asked a question about whether the set can be determined in a finite amount of time (which obviously is the case), but I am not sure whether I also asked for an efficient method. If so, I apologize for the duplicate.







share|cite|improve this question



















  • This is a nice question. I suspect the answer is "no". My next improvement for the brute force method would be to factor $k$ and collect those primes such that $p-1$ divides $k$. Such an approach does not lower the complexiity to below $O(k log k)$ though, which is quite slow.
    – davidlowryduda♦
    Jul 28 at 21:55










  • See mathoverflow.net/questions/31691/inverting-the-totient-function and math.stackexchange.com/a/23955/589
    – lhf
    Jul 28 at 22:30











  • Don't know whether this fits your "efficient"-requirement (likely not) but see Max Alexejev's implementation home.gwu.edu/~maxal/gpscripts
    – Gottfried Helms
    Jul 29 at 2:40










  • @GottfriedHelms I think in the meantime I have managed to implement an effective algorithm. I used the $p-1mid k$ - idea from above and additionaly, if we define $S$ to be the set of prime numbers satisfying $p-1mid k$ and $$P:=prod_pin S fracpp-1$$ we have the inequality $nle kP$ which accelerates the search significantically.
    – Peter
    Jul 29 at 12:11











  • Peter, why not putting this as an answer and close-the-case by "accepting" it?(Also I'm curious to see your formula more explicite :) )
    – Gottfried Helms
    Jul 30 at 15:12













up vote
3
down vote

favorite
1









up vote
3
down vote

favorite
1






1





A positive integer $kge 1$ is given. The object is to find all positive integers $n$ with $varphi(n)=k$




Is there an EFFICIENT algorithm to determine the set of numbers ?




It is clear that we can rule out prime factors $pge k+2$ and that we can also bound the exponents corresponding to all possible prime factors. But this brute force method is very slow. Is there a trick to get the set faster ? In particular nice would be an implementation in PARI/GP.



If I remember right, I asked a question about whether the set can be determined in a finite amount of time (which obviously is the case), but I am not sure whether I also asked for an efficient method. If so, I apologize for the duplicate.







share|cite|improve this question











A positive integer $kge 1$ is given. The object is to find all positive integers $n$ with $varphi(n)=k$




Is there an EFFICIENT algorithm to determine the set of numbers ?




It is clear that we can rule out prime factors $pge k+2$ and that we can also bound the exponents corresponding to all possible prime factors. But this brute force method is very slow. Is there a trick to get the set faster ? In particular nice would be an implementation in PARI/GP.



If I remember right, I asked a question about whether the set can be determined in a finite amount of time (which obviously is the case), but I am not sure whether I also asked for an efficient method. If so, I apologize for the duplicate.









share|cite|improve this question










share|cite|improve this question




share|cite|improve this question









asked Jul 28 at 20:53









Peter

44.9k938119




44.9k938119











  • This is a nice question. I suspect the answer is "no". My next improvement for the brute force method would be to factor $k$ and collect those primes such that $p-1$ divides $k$. Such an approach does not lower the complexiity to below $O(k log k)$ though, which is quite slow.
    – davidlowryduda♦
    Jul 28 at 21:55










  • See mathoverflow.net/questions/31691/inverting-the-totient-function and math.stackexchange.com/a/23955/589
    – lhf
    Jul 28 at 22:30











  • Don't know whether this fits your "efficient"-requirement (likely not) but see Max Alexejev's implementation home.gwu.edu/~maxal/gpscripts
    – Gottfried Helms
    Jul 29 at 2:40










  • @GottfriedHelms I think in the meantime I have managed to implement an effective algorithm. I used the $p-1mid k$ - idea from above and additionaly, if we define $S$ to be the set of prime numbers satisfying $p-1mid k$ and $$P:=prod_pin S fracpp-1$$ we have the inequality $nle kP$ which accelerates the search significantically.
    – Peter
    Jul 29 at 12:11











  • Peter, why not putting this as an answer and close-the-case by "accepting" it?(Also I'm curious to see your formula more explicite :) )
    – Gottfried Helms
    Jul 30 at 15:12

















  • This is a nice question. I suspect the answer is "no". My next improvement for the brute force method would be to factor $k$ and collect those primes such that $p-1$ divides $k$. Such an approach does not lower the complexiity to below $O(k log k)$ though, which is quite slow.
    – davidlowryduda♦
    Jul 28 at 21:55










  • See mathoverflow.net/questions/31691/inverting-the-totient-function and math.stackexchange.com/a/23955/589
    – lhf
    Jul 28 at 22:30











  • Don't know whether this fits your "efficient"-requirement (likely not) but see Max Alexejev's implementation home.gwu.edu/~maxal/gpscripts
    – Gottfried Helms
    Jul 29 at 2:40










  • @GottfriedHelms I think in the meantime I have managed to implement an effective algorithm. I used the $p-1mid k$ - idea from above and additionaly, if we define $S$ to be the set of prime numbers satisfying $p-1mid k$ and $$P:=prod_pin S fracpp-1$$ we have the inequality $nle kP$ which accelerates the search significantically.
    – Peter
    Jul 29 at 12:11











  • Peter, why not putting this as an answer and close-the-case by "accepting" it?(Also I'm curious to see your formula more explicite :) )
    – Gottfried Helms
    Jul 30 at 15:12
















This is a nice question. I suspect the answer is "no". My next improvement for the brute force method would be to factor $k$ and collect those primes such that $p-1$ divides $k$. Such an approach does not lower the complexiity to below $O(k log k)$ though, which is quite slow.
– davidlowryduda♦
Jul 28 at 21:55




This is a nice question. I suspect the answer is "no". My next improvement for the brute force method would be to factor $k$ and collect those primes such that $p-1$ divides $k$. Such an approach does not lower the complexiity to below $O(k log k)$ though, which is quite slow.
– davidlowryduda♦
Jul 28 at 21:55












See mathoverflow.net/questions/31691/inverting-the-totient-function and math.stackexchange.com/a/23955/589
– lhf
Jul 28 at 22:30





See mathoverflow.net/questions/31691/inverting-the-totient-function and math.stackexchange.com/a/23955/589
– lhf
Jul 28 at 22:30













Don't know whether this fits your "efficient"-requirement (likely not) but see Max Alexejev's implementation home.gwu.edu/~maxal/gpscripts
– Gottfried Helms
Jul 29 at 2:40




Don't know whether this fits your "efficient"-requirement (likely not) but see Max Alexejev's implementation home.gwu.edu/~maxal/gpscripts
– Gottfried Helms
Jul 29 at 2:40












@GottfriedHelms I think in the meantime I have managed to implement an effective algorithm. I used the $p-1mid k$ - idea from above and additionaly, if we define $S$ to be the set of prime numbers satisfying $p-1mid k$ and $$P:=prod_pin S fracpp-1$$ we have the inequality $nle kP$ which accelerates the search significantically.
– Peter
Jul 29 at 12:11





@GottfriedHelms I think in the meantime I have managed to implement an effective algorithm. I used the $p-1mid k$ - idea from above and additionaly, if we define $S$ to be the set of prime numbers satisfying $p-1mid k$ and $$P:=prod_pin S fracpp-1$$ we have the inequality $nle kP$ which accelerates the search significantically.
– Peter
Jul 29 at 12:11













Peter, why not putting this as an answer and close-the-case by "accepting" it?(Also I'm curious to see your formula more explicite :) )
– Gottfried Helms
Jul 30 at 15:12





Peter, why not putting this as an answer and close-the-case by "accepting" it?(Also I'm curious to see your formula more explicite :) )
– Gottfried Helms
Jul 30 at 15:12
















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%2f2865564%2fefficient-algorithm-to-determine-all-numbers-having-a-given-totient-value%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%2f2865564%2fefficient-algorithm-to-determine-all-numbers-having-a-given-totient-value%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?

Color the edges and diagonals of a regular polygon

Relationship between determinant of matrix and determinant of adjoint?