• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Quick Math Question for you guru's

MrScott81

Golden Member
I need to know a good way to compute the following without actually doing the math. I know there is a cool trick you can use without having to compute values, but I can't remember!
(x^y) mod m

This is easy for small numbers, but for stuff like 20^105 % 48 it becomes ugly.
Can someone help? Thanks!
Scott
 
Originally posted by: MrScott81
I need to know a good way to compute the following without actually doing the math. I know there is a cool trick you can use without having to compute values, but I can't remember!
(x^y) mod m

This is easy for small numbers, but for stuff like 20^105 % 48 it becomes ugly.
Can someone help? Thanks!
Scott

so, you want the first few digits of the remainder?
 
Originally posted by: Gibson486
Originally posted by: MrScott81
I need to know a good way to compute the following without actually doing the math. I know there is a cool trick you can use without having to compute values, but I can't remember!
(x^y) mod m

This is easy for small numbers, but for stuff like 20^105 % 48 it becomes ugly.
Can someone help? Thanks!
Scott

so, you want the first few digits of the remainder?

No I need to compute x to the power of y modulo m.


Thanks, but this is for a computer program, so I can't hardcode stuff 🙂

Anyone else?? I know I learned this before!
 
Are you doing something dealing with encryption? Either way, many encryption algorithms use math similar to this and have very efficient algorithms for said math. It's been a few years so I don't recall the names of the specific algorithm but I know I used it while working with the Jacobi algorithm, so mabye a search on Jacobi will turn up something helpful for you.
 
Back
Top