I want to decide the following:
Let $p$ be a prime number. Decide $$\sum_{k=0}^{n} \phi(p^k)$$
This is my solution so far:
We know that $\phi(p^k) =p^k-p^{k-1} $. We also know that $\phi(p^0)=\phi(1)=1.$
$$\sum_{k=0}^{n} \phi(p^k)=\sum_{k=0}^{n} p^k-p^{k-1}=\sum_{k=0}^{n} p^{k-1}\cdot(p-1)=\sum_{k=0}^{n} p^k\cdot(1-\dfrac{1}{p}) =\sum_{k=0}^{n}p^k \cdot\dfrac{p-1}{p}=\dfrac{p^n-p^1}{p-1}\cdot\dfrac{p-1}{p}=\dfrac{p^n-1}{p}$$
It is the wrong answer but I don't know why. Any help?
Part of the difficulty arises because (as you recognized) the value of $\phi(p^0)=1$ does not conform to the standard formula $\phi(p^k)=p^k-p^{k-1}$
So you should take that term outside of the summation, viz: $$\sum_{k=0}^n \phi(p^k)=(\sum_{k=1}^n \phi(p^k))+1$$
Now make your substitution: $$(\sum_{k=1}^n \phi(p^k))+1=(\sum_{k=1}^n (p^k-p^{k-1}))+1$$
Next, use the trick suggested by Dietrich Burde: $$(\sum_{k=1}^n (p^k-p^{k-1}))+1=(\sum_{k=1}^n p^k-\sum_{k=1}^n p^{k-1})+1$$
Now, reassign the indices in the second summation: $$(\sum_{k=1}^n (p^k-p^{k-1}))+1=(\sum_{k=1}^n p^k-\sum_{k=0}^{n-1} p^{k})+1$$
Once again, take the value for $k=0$ outside the summation: $$(\sum_{k=1}^n (p^k-p^{k-1}))+1=(\sum_{k=1}^n p^k-\sum_{k=1}^{n-1} p^{k})-1+1$$ It should be apparent that the $-1+1$ cancels to $0$, and each summation features the same terms, once added and once subtracted, except for the term for $k=n$, which remains to yield $p^n$ as the sum you are looking for. $$\sum_{k=0}^n \phi(p^k)=p^n$$