Given integer N, return summation from 0 to N in Log time complexity