title: given n, how to find the number of different ways to write n as the sum of 1, 3, 4 in ruby？
body: <p>Problem: given n, find the number of different ways to write n as the sum of 1, 3, 4
  Example:for n=5, the answer is 6</p>
  
  <pre><code> 5=1+1+1+1+1
   5=1+1+3
   5=1+3+1
   5=3+1+1
   5=1+4
   5=4+1
  </code></pre>
  
  <p>I have tried with permutation method,but its efficiency is very low,is there  a more efficient way to do？</p>