sympy/sympy — pull request #2899 by avichaldayal (2014-02-11 10:54:16+00:00)
Title: Residues: Try replacing x with 1/x when series fails

I made a function for the part where it finds the series trying various values of n because I needed to call it again.
It tries n = 0, 1, 2, 4 ...
but n = 1 didn't work as exp(x) = 1 + O(x) was not enough. It needs one more term.