Moved

Moved. See https://slott56.github.io. All new content goes to the new site. This is a legacy, and will likely be dropped five years after the last post in Jan 2023.

Friday, March 5, 2010

Fun

XKCD - http://xkcd.com/710/


I remember learning about this as an undergrad at Syracuse University in the 70's and didn't think much of it. It was just "one of those things" that I heard about, and perhaps wrote a homework assignment in APL or Algol-W.

The good old days. When a program to examine the conjecture was hours of heavy thinking followed by carefully monitored run-times on an IBM 370. Computer time was money back in the day. Every minute counted. And you could spend your precious budget checking the Syracuse function or going out with friends.

My solution to the Project Euler problem is 18 lines of Python.

With a few memoization tricks, it runs in something like 3 seconds on my little MacBook. Back in the day, I don't think it even compiled that quickly.

1 comment:

  1. My solution is about twice as many lines of Java, but I didn't use any memoization tricks so it would get a bit longer. Even without caching any values it only took about 9 seconds (on a fairly new desktop machine). It would certainly speed things up if I stored the lengths of the sequences, at least for each starting value. It would probably complicate the code beyond all recognition if I tried to cache all of the intermediate values as well.

    ReplyDelete

Note: Only a member of this blog may post a comment.