Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: TMTOWTDI Puzzle: Generating a range of numbers

by toma (Vicar)
on Dec 19, 2001 at 11:36 UTC ( #133044=note: print w/ replies, xml ) Need Help??


in reply to TMTOWTDI Puzzle: Generating a range of numbers

Are logical operators too obvious for this sort of challenge?

#!/usr/bin/perl use strict; my ($one,$two,$three,$four,$five,$six,$seven,$eight,$nine,$ten); $one="x" eq "x"; $two= $one << $one; $three= $one | $two; $four= $two << $one; $five= $four | $one; $six= $four | $two; $seven= $four | $two | $one; $eight= $four << $one; $nine= $eight | $one; $ten= $eight | $two; print "$one $two $three $four $five $six $seven $eight $nine $ten\n";

This sort of thing comes up in computer design. On the long path from transistors to programs, implementations are crushingly brute-force!

It should work perfectly the first time! - toma


Comment on Re: TMTOWTDI Puzzle: Generating a range of numbers
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2015-07-06 09:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (70 votes), past polls