When you write your Python program, try switching between the my_exp and my_exp2 algorithms. I wouldn't be surprised if you actually notice the speed difference, at least outside of really tiny n. (Please report whether you can?)
Will do!
Interesting that it takes more work to calculate the inverse than to check it
This is extremely common, and is in fact a very important principle.
http://en.wikipedia.org/wiki/P_versus_NP_problem
Yup, I know about P vs. NP. Fascinating stuff.
 Although only CC's my_exp2 is actually polynomial. my_exp is O(log(n)) which is pretty efficient, just not nearly as efficient as checking the inverse!
 Although only CC's my_exp2 is actually polynomial. my_exp is O(log(n)) which is pretty efficient, just not nearly as efficient as checking the inverse! 
				 
 
		 
 
		
 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		