title: Triple Fibonacci using linear recursion in Java
body: <p>I'm trying to code a linear recursive Triple Fibonacci (meaning Triple Fibonacci numbers are inspired by Fibonacci numbers but start with three predetermined values, each value afterwards being the sum of the preceding three values.)</p>
  
  <p>One of the constraints is basically to make it tail recursive, but so far I haven't had any chance with this piece of code:</p>
  
  <pre><code>public class TailRecursiveOddonacci {
  
  public long tailOddonacci(int n) {
      if (n &lt;= 3) {
          return 1;
      }
      return tailOddonacciRecursion(0, 1, 2, n);
  }
  
  private long tailOddonacciRecursion(int a, int b, int c, int count) {
      if(count &lt;= 0) { 
          return a;
      }
      return tailOddonacciRecursion(b, a+b, a+b+c, count-1);
  }
  }
  </code></pre>
  
  <p>I'm having a hard time finding out why it's not working...</p>
  
  <p>EDIT: The n in this case is a non-negative integer. So for example, 10 is supposed to return 105, or 5 is supposed to return 5.</p>