if a, b, m, n ϵ Fp
, with p
is prime
, and
if b = a^m
and c = b^n
, the following should be true:
c == b^n == (a^m)^n == (a^n)^m == a^mn == a^nm
b * c == a^(m + mn) == a^(m * (1+n))
The following code exhibits error behavior for c == a^mn
and c = a^nm
and b*c == a^(m + mn) == a^(m * (1 + n))
.
p = 3541
Fp = GF(p)
a = Fp(114)
m = Fp(526)
n = Fp(3350)
b = a^m
c = b^n
print("\nGiven b = a^m and c == b^n, in prime field")
print(" Test 1: c == b^n == (a^m)^n == (a^n)^m == a^(m*n) == a^(n*m) ")
print(" where,a: %d, m: %d, n: %d, b: %d, c: %d , a_mn: %d " %(a, m, n, b, c, a^(m* n)))
c == b^n
c == (a^m)^n
c == (a^n)^m
c == a^(m*n)
c == a^(n*m)
a^(m*n) == a^(n*m)
print(" Test 2: b*c == a^m*b^n == a^(m + mn) == a^m(1 + n)")
print(" where, b*c: %d, a^m*b^n: %d, a^(m * ( 1 +n )): %d, a^(m * (1+n)): %d" %( b*c, a^m*b^n, a^(m * ( 1 +n )), a^(m * (1+n
))))
b*c == a^m*b^n
b*c == a^(m * ( 1 +n ))
b*c == a^(m * (1+n))
a^(m * (1+n)) == a^(m + m*n)
Given b = a^m and c == b^n, in prime field
Test 1: c == b^n == (a^m)^n == (a^n)^m == a^(m*n) == a^(n*m)
where,a: 114, m: 526, n: 3350, b: 1494, c: 2584 , a_mn: 1310
True
True
True
False
False
True
Test 2: b*c == a^m*b^n == a^(m + mn) == a^m(1 + n)
where, b*c: 806, a^m*b^n: 806, a^(m * ( 1 +n )): 2508, a^(m * (1+n)): 2508
True
False
False
True
Can someone help with these problems in with exponents? Is there an alternative approach?