#include <stdio.h>
int f(int n);
int dp[10000000];
int cmp[10000000];
int main(void)
{
int a, b, max = 0; max_num = 0;
scanf("%d %d", &a, &b);
for (int i = a; i<=b; i++)
{
cmp[i] = f(i, 0);
if (cmp[i] > max)
{
max = cmp[i];
max_num = i;
}
}
}
int f(int n, int cnt)
{
cnt++;
if (n == 1) return dp[n] = 1;
if (dp[n] == 0)
{
if (n % 2 == 0) return f(2 * n, cnt);
if (n % 2 != 0) return f(3 * n + 1, cnt);
}
}
To embed this program on your website, copy the following code and paste it into your website's HTML: