Originally Posted by

**john.c**
I vote to not explain it to him. If he can't figure it out from what's been given so far then that's too bad.

I solved the problem by own way but it is very slow. How can i get to the conclusion faster? it takes about 4 hours. At least answer this.

MY CODE:

insert
Code:

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
unsigned long long int gcd(unsigned long long int n, unsigned long long int b);
int main()
{
unsigned long long int n, b = 13, gn = 0;
printf("Enter n:");
scanf_s("%llu", &n);
if (n < 4)
{
printf("\nERROR!!\n");
}
else if (n == 4)
printf("\n g(%llu): 13\n", n);
else if (n == 5)
gn = b + gcd(n, b);
else
for (unsigned long long int i = 5; i < n; i++)
{
b = b + gcd(i, b);
gn = b + gcd(i+1, b);
}
printf("\n%llu\n", gn);
printf("\n\n");
system("pause");
}
unsigned long long int gcd(unsigned long long int n, unsigned long long int b)
{
if (b == 0)
return n;
else
return gcd(b, n % b);
}