Baidu interview question

Code from a mathematical formula.