Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

RE: Primes

by stephen (Priest)
on Apr 06, 2000 at 02:00 UTC ( [id://6976]=note: print w/replies, xml ) Need Help??


in reply to Primes

I'm not sure if this goes in "Craft" or "Obfuscated", but it is cool.

I suppose it would be possible for some deranged individual to create a Math::Regexp module, that does all math calculations via regular expressions... First person to do so wins Stephen's Too Much Time On Their Hands Award (TMTOTH).

stephen

Replies are listed 'Best First'.
RE: RE: Primes
by japhy (Canon) on Apr 09, 2000 at 00:14 UTC
    Regular expressions can be made to solve diophantine equations! Please examine:
    # for the equation: 3x + 2y + 10z = 50 ($x,$y,$z,$ans) = (3,2,10,50); $xpat = 0 x $x; $ypat = 0 x $y; $zpat = 0 x $z; if ((0 x $ans) =~ /^ ((?:$xpat)+) ((?:$ypat)+) ((?:$zpat)+) $/x) { print "x = ", length($1)/$x, "\n"; print "y = ", length($2)/$y, "\n"; print "z = ", length($3)/$z, "\n"; }
    You can change this by making them * instead of +, or *? or +?. Isn't it sick?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://6976]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2024-04-19 10:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found