fork download
  1. <?php
  2. function compute($a, $d, $n, $s) {
  3. $nth = $a + ($n - 1) * $d;
  4. $sum = ($s / 2) * (2 * $a + ($s - 1) * $d);
  5. return $nth + $sum;
  6. }
  7. echo compute(3, 2, 50, 20);
  8. ?>
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
541