DRY up code

* @n = (1..n) in initialize

* Consistent use of #reduce