I want to prove the expression by method of mathematical induction with Mathematica, but I do not know how to start. How do I tell Mathematica to do that?
S <- 0
i <- 0
while i < n
S <- S + n
i <- i + 1
return S
Basis Step: k = 0. When k = 0, that is when the loop is not entered, S = 0 and i = 0. Hence S = k*n and i = k hold.
Induction Hypothesis: For an arbitrary value m of k, S = m * n and i = m hold after going through the loop m times.
Inductive Step: When the loop is entered (m + 1)-st time, S = m*n and i = m at the beginning of the loop. Inside the loop,
S <- m*n + n
i <- i + 1
producing S = (m + 1)*n and i = m + 1.
Thus S = k*n and i = k hold for any natural number k.