Jump to content

Talk:Modular exponentiation: Difference between revisions

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
Content deleted Content added
No edit summary
No edit summary
Line 5: Line 5:




modpow is not complete. for all x, (x^1 mod 1) is 0, not 1.
modpow is not complete. for all x, (x^0 mod 1) is 0, not 1.
because e is zero, the loop is ignored and a result of 1 is returned.
because e is zero, the loop is ignored and a result of 1 is returned.
one general fix for this is:
one general fix for this is:

Revision as of 02:50, 12 November 2005

Could discuss top down vs. bottom up exponentiation.

Could add optimizations (for "top down") that are faster but use more memory. Examples: bit windowing (or sliding windows).


modpow is not complete. for all x, (x^0 mod 1) is 0, not 1. because e is zero, the loop is ignored and a result of 1 is returned. one general fix for this is:

return result % m;

another would be a fairly thorough conditional statement.