Problem 206

completed January 6, 2012

Comments

The only difficulty with this one was making sure I was testing the correct digits. At first my code wasn’t working because I was having it look at the even numbered digits instead of the odd numbered digits. Once I caught the mistake, the script worked nicely.

Code

num = 1000000000
squ = str(pow(num, 2))

while len(squ) == 19:
	if [squ[0], squ[2], squ[4], squ[6], squ[8], squ[10], squ[12], squ[14], squ[16], squ[18]] == map(str, (1, 2, 3, 4, 5, 6, 7, 8, 9, 0)):
		print [[[[num]]]]
		break
	num += 10
	squ = str(num**2)