title: Using recursion to find a sequence of sums and products that equals a given number
body: <p>I'm trying to translate this example of recursion from Eloquent Javascript into Ruby. </p>
  
  <pre><code>function findSolution(target) {
    function find(start, history) {
      if (start == target)
        return history;
      else if (start &gt; target)
        return null;
      else
        return find(start + 5, "(" + history + " + 5)") ||
               find(start * 3, "(" + history + " * 3)");
    }
    return find(1, "1");
  }
  
  console.log(findSolution(24));
  // → (((1 * 3) + 5) * 3)
  </code></pre>
  
  <p>So far I've only got the following, which I understand is completely wrong. I'm trying to challenge myself by learning to rewrite a concept I don't fully understand yet.</p>
  
  <pre><code>def find_solution(n)
    i = 1 
    history = ""
    if (i *= 3) &gt; n &amp;&amp; (i += 5) &gt; n 
      return nil 
    elsif i == n 
      return history 
    else 
      return (i *= 3 &amp;&amp; history &lt;&lt; "#{i} * 3") || (i += 5 &amp;&amp; history &lt;&lt; "#{i} + 5")
    end 
    find_solution
  end 
  </code></pre>