[racket] Generative recursion
Wow, I came up with a really weird solution then, based on the fact that
append "eats" occurrences of empty: (append empty empty empty empty (list
4)) is (list 4). I divided input by a copy of itself inside a call to
append, then looped with (sub1 input), returning empty if input/(sub1
modified-input) wasn't a divisor, else (list input). It's really not a
generative solution, just a confusing structural one.
On Fri, Nov 5, 2010 at 06:16, Jos Koot <jos.koot at telefonica.net> wrote:
> Luke, you'd better ignore my third approach and follow the instructions
> of Todd.
> My method is far more difficult to implement than Todd's methods.
> Jos
>
> ------------------------------
> *From:* users-bounces at racket-lang.org [mailto:
> users-bounces at racket-lang.org] *On Behalf Of *Jos Koot
> *Sent:* 05 November 2010 12:06
> *To:* 'Todd O'Bryan'; lukejordan at gmail.com
>
> *Cc:* users at racket-lang.org
> *Subject:* Re: [racket] Generative recursion
>
> Actually there is one more way. We only have to check numbers 1 up to the
> integer-sqrt of n. For each check whose remainder is 0, we immediately have
> two divisors, the checking number and the quotient (except when these two
> are equal, giving one divisor only -this happens only when n is a square-))
>
> Jos
> ------------------------------
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20101105/c92c9223/attachment.html>