Triangles and More

"Riley" <[email protected]> Mon, 2 Aug 2004 10:23:27 -0500
Newsgroups gmane.comp.lang.perl.golf
Organization Legalbill
Message-ID <[email protected]>
Hello, All!

Mtve, I thought the following short (and quite obfuscated) entry was
particularly brilliant. I wanted it to be shorter so it could be the winning
entry...

-lp $_=s/./$z|=11x$&;1x$&/eg&/$z/

It reminds me of someone's clever way of determining if a number is prime,
which (at least in my version) turns out to be of similar length:

-l print 0|(1x pop)!~/^(11+)\1+$/

I'm writing the above from memory, so I'm not sure if it's exact. Does
anyone know the origin of this algorithm? Was it the result of some ancient
golf?

Many thanks,
Riley
(o0lit3)

P.S.
For those inconvenienced, sorry for all the bugs in the testsuite of
Mastermind