Little problem

Jorge Adriano [email protected]
Wed, 27 Mar 2002 16:29:59 +0000


[moving to haskell-cafe]

>        Hello
>        I have little problem. I want to solve this equation
>
>           f(n-1) = f(n)+n
>           f(6)=6 

This is a simple recursive definition..
By the way, are you sure you didn't meant:
f(n-1)=f(n)+(n-1)


>           => f(2)=?

Not exactly sure what you're after here. You could simply do:
f(2)
=f(3)+3
=f(4)+4+3
=f(5)+5+4+3
=f(6)+6+5+4+3
=6+6+5+4+3
=24

anyway it's simple to see, or even prove by induction, that
f(n) = (\sum_{i=n+1}^{7} i) -1 = (n+8)(7-n)/2 - 1

If I'm rigth and you're formula is suposed to be 
f(n-1) = f(n)+n
it is even easier.

J.A.