if - GoldenScheme - Scheme on JavaScript

Result:

Source:
(begin 
  (define (sum-gp a0 r n) 
    (* 
      a0 
      (if (= r 1)
        n 
        (/ (- 1 (expt r n)) (- 1 r))
      )
    )
  )
  (sum-gp 2 3 3)
)
Home