A generalization of Euler’s pentagonal number recurrence for the partition function