You are on page 1of 1

class tp {

static int number_of_divisors(int x){


int i = 1;
int n = 0;
if (i <= x){
if ((x % i) == 0){
n = n + 1;
}
i = i+1;
}
return n;
}

static int big_dif_prime (int x){


int i =4;
int p1 = 2;
int p2 = 3;
int aux;
int dif = 1;
while (i <= x){
if (p1 > p2){
aux = p2;
p2 = p1;
p1 = aux;
}
if ((p2 - p1)>dif){
dif = p2 - p1;
}
if (number_of_divisors(i)==2){
p1 = i;
}
i++;
}
return dif;
}

You might also like