In the era of software development where programmers don't really program anymore, there are still hang out spots on the web where you can pick up your old memories. I've been spending time solving riddles on ProjectEuler.net. It's been rediculously addictive. I am also taking this opportunity to learn Python, which is a modern dynamic language. Just to demostrate how slick it is, here's the code that reads in a list of words from a text file and counts the number of triangular words in it (Problem 42) :
f = open("p42.txt").read().split(",")
words = [str.upper(str.strip( w.replace('"', ''))) for w in f]
val = [ sum( [ord(c)-64 for c in w]) for w in words]
trinums = [ (.5*n**2+.5*n) for n in xrange(1, max(val))]
print len( [ n for n in val if n in trinums])
And this is the code that counts the product of the 10th, 100th, 1,000th, 10,000th, 100,000th, and 1,000,000th digits of an irrational decimal fraction (Problem 40.) Guess how long it is:
res = "".join([str(i) for i in xrange(10**6+1)])
print reduce(lambda x,y: x*y, [ int(res[10**i]) for i in xrange(1, 7)])
Just looking at it gives me a boner.