title: Arithmetic sequence in Ruby using #reduce
body: <p>The question is simple: implement an arithmetic sequence algorithm with params (first,n,c) where first is the first number in the sequence, n is the nth index in the sequence, and c is the addition number for the sequence. This is what I've done but so far it's giving me wrong answers.</p>
  
  <p>EDIT: found solution, below</p>
  
  <pre><code>def nthterm(first, n, c)
   (1..n).reduce(first){|memo, x| memo += c}
  end
  
  
  
  Test.assert_equals(nthterm(1, 2, 3), 7)
  Test.assert_equals(nthterm(2, 2, 2), 6)
  Test.assert_equals(nthterm(-50, 10, 20), 150)
  </code></pre>