Hootsuite interview question

Implementing the algorithm given the mathematical formula.