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.k...@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-boun...@racket-lang.org [mailto: > users-boun...@racket-lang.org] *On Behalf Of *Jos Koot > *Sent:* 05 November 2010 12:06 > *To:* 'Todd O'Bryan'; lukejor...@gmail.com > > *Cc:* users@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 > ------------------------------ > >
_________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users