.NET Fiddle

CSharp · Console

/Program.cs

using System;

public class Program
{   
    public static void Main()
    {
        int countMAX = 0;
        int num = 0;

        for (int i = 2; i <= 1000000; i++)
        {
            int count = 1;

            int temp = i;

            while (temp != 1)
            {
                if(temp % 2 == 0) temp /= 2;
                else temp = temp * 3 + 1;
                count++;
            }

            if(count > countMAX)
            {
                countMAX = count;
                num = i;
            }
        }

        Console.WriteLine("Number: " + num + " Hops: " +countMAX);
    }
}
;