Sponsored links: Algebra eBooks
 

Help Index

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

The Maxima on-line user's manual

Algebra Calculator

Search:

Power_mod Calculator

Power_mod

Function: power_mod (<a>, <n>, <m>) Uses a modular algorithm to compute a^n mod m where <a> and <n> are integers and <m> is a positive integer. If <n> is negative, inv_mod is used to find the modular inverse.

p:47;
q:59;
n:p*q;
phi_n: (p-1)*(q-1);
d:1765;
e:inv_mod(d,phi_n);
gcd(e,phi_n);
d:inv_mod(e,phi_n);
e1:inv_mod(d,phi_n);
m:65;
c:power_mod(m,e,n);
power_mod(c,d,n);

          (%i1) power_mod(3, 15, 5);
          (%o1)                          2
          (%i2) mod(3^15,5);
          (%o2)                          2
          (%i3) power_mod(2, -1, 5);
          (%o3)                          3
          (%i4) inv_mod(2,5);
          (%o4)                          3

(%o1)                                true
(%i2) 

Power_mod Example

Related Examples

mod-power_mod

a = power_mod(4885896...

b = power_mod(3008863...

Calculate

mod-power_mod

power_mod(4125321, 57...

power_mod(3115211, 57...

power_mod(237520, 312...

Calculate

mod-power_mod

power_mod(140, 330, 2...

power_mod(140, 331, 2...

power_mod(140, 332, 2...

Calculate

mod-power_mod

power_mod(1865, 210, ...

power_mod(1865, 211, ...

power_mod(1865, 212, ...

Calculate

mod-power_mod

power_mod(10470757,15...

Calculate

mod-power_mod

power_mod(2,749,1961);

Calculate

mod-power_mod

power_mod(1211,21,3232);

Calculate

mod-power_mod

power_mod(110,749,1961);

Calculate

mod-power_mod

power_mod(1865, 210, ...

power_mod(1865, 211, ...

power_mod(1865, 212, ...

Calculate

mod-power_mod

power_mod(1865, 280, ...

power_mod(1865, 281, ...

power_mod(1865, 282, ...

Calculate