Front page | perl.fwp |
Postings from March 2002
Re: TPR1 post-mortem
Thread Previous
|
Thread Next
From:
Prakash Kailasa
Date:
March 8, 2002 07:11
Subject:
Re: TPR1 post-mortem
Message ID:
20020308150923.GA21012@seisint.com
Hats off to Ton, Lars and many others. And, thanks to Dave and Jerome
for making this happen. This was the most fun I had in a long time.
Thanks to Marcelo for the explanation.
I request others to follow with their own accounts about how they
arrived at their formula(e|s). I am especially intrigued with the
usage of hex() by Ton and Chris (I haven't looked at all the results,
so there might be others too). How the heck did you guys think of such
a thing?
Incredible.
Compared to these, mine was a simplistic $1+0&&1+($1+8)%9, and I was
proud about myself for coming up with it, oh, may be for a brief
second. I have a long way to go.
Can't wait to read your stories. Keep'em coming.
/prakash
On Fri, Mar 08, 2002 at 03:16:10PM +0100, Marcelo E. Magallon wrote:
> >> Jason Purdy <jason@journalistic.com> writes:
>
> > Is that #*1.11%10 a number theory to get to the same number? How did
> > someone recognize that pattern? (my advanced calculus/comb math being
> > a lil' rusty)
>
> I don't know others, but I started by looking at the input and output,
> like this:
>
> 0 0
> 1 1
> ... ...
> 9 9
> 10 1
> 11 2
> 12 3
> ... ...
> 18 9
> 19 1
> 20 2
>
> As you can see it's just a series of 1 .. 9, except for 0. With that
> in mind my first I tried something like (0,(1..9)x11)[$n]. Actually,
> before that I tried something more like (0,(1..9)x2)[$a+$b] (where $a
> and $b are the digits). Then I noticed that I could get the same
> result using %9 and some conditionals. After putting this stuff aside
> and having some sleep I just pictured the thing as a table like this:
>
> 0 1 2 3 4 ...
> 0 00 11 22 33 44 ...
> 1 10 21 32 43 54 ...
> ...
> 8 80 91 12 23 34 ...
> 9 90 11 22 33 44 ...
>
> which made it kind of evident that 111%100 should do what I wanted.
> *Then* I had a different problem to solve :-)
>
> > What is \G ... $&? Gotta dig out my Camel book again.
>
> Check out perlre and perlvar and the "g" option to m//.
>
> A question of my own: why doesn't
>
> s/\B.\B/$&$&/g
>
> work as I expect, namely abcd -> abbccd. I really can't figure it out
> by reading the docs.
>
> TIA,
>
> Marcelo
--
Prakash Kailasa <mailto:PKailasa@seisint.com>
==
Arnold's Addendum:
Anything not fitting into these categories causes cancer in rats.
==
Thread Previous
|
Thread Next