XemnasXD wrote:
LuV3r8o1 wrote:
Kitt wrote:
Can anyone solve this ???? ~_~
when x = 0 the answer is 4
x= 1 is 5
x=2 is 9
x=3 is 18
x=4 is 34
x=5 is 59
x=6 is 95
its the previous answer + x*x
f(x) = 4 IFF x = 0
f(x) = f(x-1) + x^2 IFF x > 0
amirite?
but if x= 1 then
f(x)= (1-1) +1^2 and that doesn't =5 .....right
No. It's recursive.
if x = 1, then
f(x) = f(1-1)+ 1^2
f(x) = f(0) + 1
f(x) = 4 +1
f(x) = 5
since f(x) = 4 when x = 0
XemnasXD wrote:
also are you allowed to some up with 2 solutions in these problems

Well, since i assumed it was recursive, I needed a base case. Since you never mentioned negative numbers and i'm too lazy to do the work, I just stopped at f(0) = 4 and didn't worry about negative numbers.
So, the base case is f(0) = 4 and all you have to say is that this function only works for real, positive integers.
But I have no idea what the question to the problem is, so this is all assumption that it solves your problem.