Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 299
  • Last Modified:

Inverse Modular

Hi,

I'm studying C++ and I have to create a program that caculates the inverse modular using two numbers as inputs ( x and m ) and one output ( n ), the inverse modular.

Can anyone give me a hand with the math behind it?

Thanks!
0
Emilio06
Asked:
Emilio06
1 Solution
 
tinchosCommented:
hi

i'm from argentina, and i'm not so familiar with maths expresions

so, if you clarify what inverse modular is maybe i can help you
0
 
ExceterCommented:
0
 
CoolBreezeCommented:
you are fast Exceter!
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
ExceterCommented:
I am? Thanks!
0
 
Emilio06Author Commented:
Exceter, can you please demonstrate the process in the link you've given my in your own words, using the variables i defined?

Thanks.
0
 
ExceterCommented:
>> Exceter, can you please demonstrate the process in the link you've given my in your own words, using the variables i defined?

I don't think I can do a better job than did Doctor Wilkinson. That was a pretty good explanation.

Exceter
0
 
Emilio06Author Commented:
thanks for your help,

btw this is the function:
 

int modinverse(int x,int n)

{                                           int kn,a,la,q,t;
      kn=n;
      x%=n;
      if (x<0) x+=n;
      a=1;      la=0;
      while (x>1)
      {                                      q=n/x;
        t=la-a*q; la=a; a=t;
        t=n-x*q;  n=x;  x=t;
     }
   if   (x==0) return 0;
     if (a<0) a+=kn;

     return a;
}                      
0
 
ExceterCommented:
Why the C? You asked for help with the math and that is exactly what I gave you.
0
 
Emilio06Author Commented:
meh you got your points
0
 
ExceterCommented:
But why the C?
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now