title: Fibonacci function result confusion
body: <pre><code>public class Fibonacci {
      public static long fib(int n) {
          if (n &lt;= 1) return n;
          else return fib(n-1) + fib(n-2);
      }
  
      public static void main(String[] args) {
          int N = Integer.parseInt(args[0]);
          for (int i = 1; i &lt;= N; i++)
              System.out.println(i + &quot;: &quot; + fib(i));
      }
  }
  </code></pre>
  <p>Let's assume that the user input &quot;java Fibonacci 7&quot;, so the result would be like this:</p>
  <blockquote>
  <p>1: 1<br />
  2: 1<br />
  3: 2<br />
  4: 3<br />
  5: 5<br />
  6: 8<br />
  7: 13</p>
  </blockquote>
  <p>I seem to be totally confused with how this works, starting with argument 3. When the fib(i) method gets passed 3, shouldn't it return 3 as well since if n = 3 then the sum of fib(n-1) /<strong>n-1 is 2</strong>/ and fib(n-2) /<strong>n-2 is 1</strong>/ is 3. And so on the other numbers forward.</p>