PCPOTATO
Navigation

Home
About
Contact
Resume

Projects

None yet

Categories

General
Interesting
Programming

Archives

August 2008
July 2008
June 2008
May 2008
April 2008
Project Euler #4 April 14th, 2008

If I had only seen the one liner at Slick or Slack (a pretty slick place) before writing this monstrosity:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
pal = 0
i = 999
while i > 0:
	j = 999
	while j > 0:
		ftemp = str(i * j)
		rtemp = ""
		for letter in ftemp:
			rtemp = letter + rtemp
		if ftemp == rtemp:
			if pal < i*j:
				pal = i*j
				break
		j = j - 1
	i = i - 1		
 
print pal

Yes I did skip #3 since I have yet to figure out how to factor huge numbers without it taking some huge distributed computing system due to my inefficient code.

Leave a Reply

You must be logged in to post a comment.

Domains


Links


Presence


Meta

Log in