Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Start with a list containing just the number 1. Then on every iteration shift off a value from the list ($n), and unshift back on $n*2, and ($n-1)/3 (if $n-1 is divisible by 3 and $n > 1), keeping track of which numbers you've seen and not re-queuing those numbers. I'm not sure offhand when to terminate though, since you'll have to temporarily go past the max limit.
    • Eh, it was just an idea.
      • Indeed: a reverse algorithm is interesting too. The idea must have blinked in my mind for a few microseconds as well, but then I realized that brute force could become very very lightweight provided one were careful enough to use already done calculations to avoid doing unnecessary ones: experimentation proved that my intuition was right, since the program pasted here gave me the answer in about 20 seconds, which is fine. Although I'm not really sure whether one should call that brute force any more. On a second thought I lean towards the hypothesis that one should not...

        -- # This prints: Just another Perl hacker, seek DATA,15,0 and print q... ; __END__