Commit 15a5d4dc authored by Alexander Camatchy's avatar Alexander Camatchy
Browse files

remodif avant fin du tp

parent 8483d68a
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ int f(x) {
  return x*x+1;
}

int has_cycle(list_t l, int n) {
int has_cycle(list_t l, int n, unsigned long int *d) {
  srand(time(NULL));
  l = list_is_empty(l);
  int x = rand() % n;
@@ -33,7 +33,7 @@ int has_cycle(list_t l, int n) {
  x = f(x) % n;
  int xk;
  l = list_push(l, x);  
  while(gcd(abs(x-f(x)), n) != 1) {
  while((*d=gcd(abs(x-f(x)), n)) != 1) {
    xk = list_top(l);
    l = list_push(l, xk);
    l = list_tail(l);
@@ -41,7 +41,7 @@ int has_cycle(list_t l, int n) {
  return 0;
}

// pollard
// rho_pollard

int main() {
  // En utilisant l'algorithme rho de Pollard, factorisez les entiers suivants