Problem 174

completed January 25, 2012

Comments

This problem is related to problem 173. I used the code from that as a starting point.

I think the hardest part about this one is trying to figure out what the dang problem was asking me for! It is written in such a complex and garbled way! But, once that was figured out, it was pretty simple.

Code

count = 0
bound = 10**6

N = dict(zip(xrange(1, bound+1), [0]*bound))

for outer in range(3, bound/4 + 2):
	if outer%1000 == 0: print outer
	for inner in range(outer-2, 0, -2):
		this = outer**2 - inner**2
		if this <= bound:
			N[this] += 1
		if this > bound:
			break

total = 0
for v in N.itervalues():
	if 1 <= v <= 10:
		total += 1

print total