Create recursive function for simulations
Fix bug in recurrence