title: Algorithm guidance with 3n+1 Conjecture
body: <p>Okay, I know this is going to sound like homework; but here goes any way. I am trying to solve this <a href="http://uva.onlinejudge.org/external/1/100.html" rel="nofollow">problem</a> using C#. The excerpt from the problem description is shown below:</p>
  
  <blockquote>
    <p>Given an input n, it is possible to determine the number of numbers
    printed (including the 1). For a given n this is called the
    cycle-length of n. In the example above, the cycle length of 22 is 16.
    For any two numbers i and j you are to determine the maximum cycle length over all numbers between i and j.</p>
  </blockquote>
  
  <h1>Question</h1>
  
  <p>I understand everything except for one thing, the cycle length. I just don't understand it exactly. I find that the text is ambiguous about the definition of it. I <strong>assume</strong>, that the cycle length is how many numbers were in the sequence so lets say that the input is 10 the cycle length would be 8. But I am just not exactly sure. No code is required on your part but guidance is all I ask.</p>
  
  <p>In addition, I already know how to read from standard input and output. Since the problem is in programming competition format. </p>
  
  <h1>My implementation of displaying the sequence of numbers giving n as input</h1>
  
  <pre><code>static void collatz(ref int n)
  {    
       if (n % 2 == 0)
       {
            n /= 2;
       }
       else
       {
            n = (3 * n) + 1;
       }
       Console.WriteLine(n);
  }
  
  static int GetCycleLength(int n)
  {
       if (n &gt; 0)
       {
            int count = 1;
            while (n != 1)
            {
                 collatz(ref n);
                 count++;
            }
            return count;
       }
       else
       {
            return -1;
       }
  }
  </code></pre>
  
  <h1>Notes</h1>
  
  <p>Although it is not homework, I want to treat as homework, so I put as one of the tags.</p>