mardi 8 décembre 2020

Discrete Logarithm in Prolog

I would like to check which of the two programs will stop:

P1() {
   X = 819688;
   while (X != 77) {
      X = (X*12367+3466) mod 4294967296;
   }
}

P2() {
   X = 955725;
   while (X != 77) {
      X = (X*12367+3466) mod 4294967296;
   }
} 

Since each iteration is kind of a function composition, ultimately leading to a power of the function inside the while loop, I guess Discrete Logarithm could maybe solve the problem. Any Prolog implementations around solving the problem?




Aucun commentaire:

Enregistrer un commentaire