Instead of $g(n) - g(n-1)$ I thing that will be $g(n-1) - g(n)$
Instead of$g(n) - g(n-1)$ I thing that will be $g(n-1) - g(n)$