See Alan's answer here: https://web2.0calc.com/members/alan/?answerpage=751
Note: If you don't understand Alan's answer, there isn't anybody here, as far as I can tell, that understands it better than Alan. If you are looking for a "simpler" solution, I'm afraid you may have to find it somewhere else.
I suggest that you interact with your student friends and with your teacher to arrive at some sort of a solution that you will understand. Even WolframAlpha comes up with this message: "(unable to determine general term)" ! Good luck to you.