Jump to content

Talk:Modular exponentiation

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by 72.19.80.208 (talk) at 02:49, 12 November 2005. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

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^1 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.