g(0) = 0, but f(0) = 1, so these are different functions.
On the other hand, if we had
The second last equality is the sum of an arithmetic progression.
Hi everyone, I'm normally ok with algebra, functions and the like but this question was posed in a clicker question in class and I don't know how to approach answering it.
The following functions produce the same answer, true or false?
f(n) = if n=0 then 1, else n + f(n-1)
g(n) = n(n+1)/2
As I have stated, this question formed part of a clicker question is class - but I would like to know the steps to solving it should something similar pop up again. The question takes a max of 3 mins to answer (clicker question limit) so I don't imagine a long rambling solution is required. As I say, any steps in solving this bad boy would be appreciated.