[racket] Sum of Even

From: Gregory Woodhouse (gregwoodhouse at me.com)
Date: Tue Sep 25 11:45:32 EDT 2012

You may have shown in a mathematics class that

1 + 2 + ... +  n = n(n + 1)/2

Do you recall how you did it? What was the induction step?

Sent from my iPhone

On Sep 25, 2012, at 8:04 AM, Ashley Fowler <afowler2 at broncos.uncfsu.edu> wrote:

> I am trying to do a recursive analysis on the Sum of even numbers function. So far I have already defined the function. I have found the base case. The hard part is finding the non-recursive definition. I'm having trouble of what non-recursive definition even means.
> 
> Step 1 - Base case: sumEven(N) = 2, if N = 1
> 
> Step 2 - Non-recursive definition =
> 
> (define sumEven
>     (lambda (N)
>       (cond((= N 1) 2)
>            ((> N 0) (*(+ N 1)N)))))
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120925/ee2a4781/attachment.html>

Posted on the users mailing list.