While loop with power.
5 visualizzazioni (ultimi 30 giorni)
Niklas Kurz il 19 Gen 2021
I'd really be curious to know how to code the statement:
thus finding p until the euqation becomes true.
Sounds to me like
while and mod()
come in handy. Of course u can follow another approach
Generally I've heard this problem consumes a lot of time.
John D'Errico il 19 Gen 2021
Modificato: John D'Errico il 19 Gen 2021
This is the discrete logarithm problem.
In general, there is no simple solution, but using a while loop seems a poor choice. There is a list of better schemes available, but nothing trivially written. Do some reading based on the links on the wiki page. For example...
But no. You don't want to use a while loop. That would be a bad idea. There is no tool in the symbolic toolbox for this purpose, nor is there a tool I have written in my toolboxes. It looks like the worse case will probably arise when N is a prime.