I am puzzled with the following discrete logarithm problem:

Given positive integers b, c, m where (b &lt; m) is True it is to find a positive integer e such that

(b**e % m == c) is True


where two stars is exponentiation (e.g. in Ruby, Python or ^ in some other languages) and % is modulo operation. Using general math symbols it looks like:($b^e \equiv c (\mod m)$). 

What is the most effective algorithm (with the lowest big-O complexity) to solve it ?

Example:
Given b=5; c=8; m=13 this algorithm must find e=7 because 5**7%13 = 8

Thank you in advance!


Question: The bottom of my black cheap pan has worn off and I can now see the metal below where food would go. Is that pan safe to use anymore?
Answer: I'm going to assume that this is a non-stick coated aluminum (maybe s/s) pan and specifically Teflon or one of the common knock-offs; those are the only types of pans I've seen that are white under the black coating. If you had well-seasoned cast iron, it would be grayish colour (well, iron).

It's not unsafe in the same sense as eating raw meat is unsafe, but there are some things you should know:


The base metal (under the coating), if it is in fact aluminum, now has a reactive surface. That means you won't be able to cook anything with vinegar, wine, tomatoes, or anything acidic, without further damaging the pan and leaching metal into your food.
Once a non-stick coating gets scratched, if there's any left, it also starts to peel, and once it starts peeling then it's very easy for it to get into your food. According to DuPont, the chemical PTFE is inert as long as it is not heated to extreme temperatures, so you shouldn't get seriously ill if you happen to eat a few flakes of it by accident. Make your own decision.
Your non-stick pan almost certainly isn't going to be non-stick anymore, which means that even though it probably won't harm you, it will be a truly awful cooking surface.


On the basis of #3 alone, I'd suggest that you replace it with a new one, especially since it was cheap to begin with.