Friday, July 13, 2007

Namespaces for PHP

I read this kinda late, but namespaces were definitely required in php and now they have been made official http://www.gravitonic.com/blog/archives/000418.html

Thursday, July 05, 2007

Project Euler

I am completely addicted to this site...its all about solving math problems using programming.

Here is the solution to one of the problems

How Many Lychrel Numbers are below 10,000 ? http://projecteuler.net/index.php?section=problems&id=55

my solution in python, which takes abt 39 seconds:-

def lychrel(x):
i = 0
while i < 50:
x += int(str(x)[::-1])
if str(x) == str(x)[::-1]:
return False
i += 1
return True

print len ([x for x in range(1,10000) if lychrel(x)])