Loop()
Where's the return type? Why are you defining another function whose name differs from a reserved name in case only?
Serial.println(answer);
Some value appears on the serial monitor. What does it mean? Adding another Serial.print() statement with some descriptive text, to be printed in front of the value is generally a good idea.
answer = f(i);
Where's the f function?
int sum(int j)
This function isn't called anywhere. Why include it?