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 110012 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 15:56.

Sat May 28 15:56:54 UTC 2022 up 44 days, 13:58, 0 users, load averages: 1.26, 1.46, 1.63