Matlab iteration

70 Views Asked by At

$p,q,e$ and $m$ are known

$n=p \times q$

$c=m^e \mod n$

I want to get the $j$, when $c=c^{e^j}$

What am I doing wrong?

function j=iter(p,q,m,e)

n=p*q

j=1;

b=m^e

c=mod(b,n)

while c~=c^(e^j)

    j=j+1;

end
end
1

There are 1 best solutions below

2
On BEST ANSWER

$$c = c^{e^j}$$

gives

$$e^j=1$$

so

$$j=0$$

So, as your program searches numbers greater than 1, it does not find the answer (which is always 0).