mersenneforum.org New way to Find (X^Y) % M
 Register FAQ Search Today's Posts Mark Forums Read

 2004-05-08, 02:50 #1 maheshexp   May 2004 52 Posts New way to Find (X^Y) % M here i had developed a simple algorithm to calculate (X^Y)%M. i works well and faster than any string manipulated operations. //(x^y)%m long r1 = x % m; // loop upto y - 1, for x ^(y-1) for (long i = 0; i < y - 1; i++) { r1 = (r1 * x) % m; } hope this works... mahesh
 2004-05-08, 02:53 #2 maheshexp   May 2004 52 Posts note r1 is the result of the function
 2004-05-08, 03:16 #3 ColdFury     Aug 2002 26·5 Posts Look at my reply in the math section....

 Similar Threads Thread Thread Starter Forum Replies Last Post Stargate38 Programming 18 2015-07-10 06:08 davar55 Math 2 2010-02-19 16:54 davar55 Puzzles 7 2009-07-02 19:46 davar55 Puzzles 25 2007-07-15 15:56 maheshexp Miscellaneous Math 29 2004-08-30 15:59

All times are UTC. The time now is 19:41.

Wed Dec 1 19:41:27 UTC 2021 up 131 days, 14:10, 1 user, load averages: 1.61, 1.55, 1.51