//recursive function
int function(int x){
if (x % 3 == 0){
return 1;
}
return 1 + function(x - 2);
}
//recursive function rewritten as loop is not working properly
int function(int x){
int num = x-2;
int sum = 0;
for (; num % 3 != 0; num -= 2){
sum = 1 + num;
return sum;
}
return 1;
}