Front page | perl.golf | Postings from May 2002

## RE: can someone please explain..

Thread Previous | Thread Next
From:
Mark Schoonover
Date:
May 8, 2002 11:56
Subject:
RE: can someone please explain..
Message ID:
BF889CEBEFD2D511B993009027F60ABE1556ED@AG-JASMINE-NT4
```Thanks to all who are discussing their solutions! I ghosted this one because
I was only able to come up with a partial solution. Now, here's what I've
noticed about the various tourneys - at what percent of the solution is
coming up with a good algorithm?? The Perl itself is tough enough, but from
what I've been able to ascertain from all the tourneys so far is that all
the entries have really cool (tm) algorithms! Where does one pick up those
skills?? Basic questions I know, but this is a major stumbling block for
some, including myself!

Great job to all those that referred and submitted soln!

..mark

> -----Original Message-----
> From: perl-golf@ton.iguana.be [mailto:perl-golf@ton.iguana.be]
> Sent: Wednesday, May 08, 2002 11:00 AM
> To: golf@perl.org
> Subject: Re: can someone please explain..
>
>
> In article <3CD9492E.22F5A716@guideguide.com>,
> 	Jasper McCrea <jasper@guideguide.com> writes:
> > Hi,
> >
> > just interested to know how:
> >
> > a) this:
> >
> > -l print map/[3-9]/?'':/1/?\$":'-',0..2x pop
> >
> >   works,
> >
> > and
>
> basically if you count in base 3, the spaces in the triadic cantor set
> are the numbers that contain 1:
>
>   - -   - -         - -   - -
>
>   000000000111111111222222222
>   000111222000111222000111222
>   012012012012012012012012012
>
> What this gem does is count in base 10, but drop all entries
> containing
> 3 to 9, so only valid base 3 numbers are left. then it uses
> the 1 criterium
> to decide to go for a space or not.
>
> And notice that for the above argument 3 example the last
> number is 222,
> so 2 x 3, which is how you get the 2 x pop for the general case.
> (it gets very slow for big arguments though)
>
> I tried to do something directly based on base 3 myself, but
> never found
> anything this short. I love it. it's a general base n for n <
> 10 counter
>
>

```
Thread Previous | Thread Next

nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About