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 #8 July 14th, 2008

Find the greatest product of five consecutive digits in the 1000-digit number.

1
2
3
4
5
6
7
8
9
10
11
product = int(digits[0]) * int(digits[1]) * int(digits[2]) * 
int(digits[3]) * int(digits[4])
i = 4
while(i < 1000):
	temp = int(digits[i]) * int(digits[i-1]) * int(digits[i-2])
 * int(digits[i-3]) * int(digits[i-4])
	if(temp > product):
		product = temp
	i = i + 1
 
print product
Leave a Reply

You must be logged in to post a comment.

Domains


Links


Presence


Meta

Log in