Project Euler Problem 233

Hint #1. Your lemma #2 is not quite right. Are you sure that's the radius?

Hint #2. The answer is closely related to the sum of squares function, r(k, n). This gives the number of ways to represent n using k different squares, allowing zeroes and distinguishing between order. For example, r(2, 5) is 8, because there are 8 ways to represent 5 using 2 squares:

(-2)^2 + (-1)^2
(-2)^2 + 1^2
2^2    + (-1)^2
2^2    + 1^2
... (and the 4 additional expressions produced by reversing these 2 terms)

You can see that a circle of radius p centered at the origin has r(2, p^2) lattice points. For example, a circle with radius 5 has:

(-4)^2 + (-3)^2
... and 7 others like this

5^2    + 0^2
(-5)^2 + 0^2
0^2    + 5^2
0^2    + (-5)^2

for a total of 12. What sorts of numbers would have 420 circle lattice points? Now what if they weren't centered at the origin? I'll let you take it from here.

If you want a much much bigger hint, I've rot-13'd (http://rot13.com) something you should check out here:

uggc://zngujbeyq.jbysenz.pbz/FpuvamryfGurberz.ugzy


Hint 1: The circle has radius n/√2, which is never an integer for integer n, so A046080 never applies.

Hint 2: Don't bother sliding the circle around. Pick it up off the graph paper and just think about it, the square that defines it, and the as yet unknown points of interest on the circumference in relation to each other.

Hint 3: The angle inscribed in a half circle is always 90 degrees.

Hint 4: How many ways can a number be written as the sum of two squares?

Bonus hint to be used liberally throughout: symmetry!


SPOILER ALERT!


Don't read further until you try to work it out from the hints above

If those hints aren't sufficient, here are some of the missing steps to interleave with the hints above:

Hint 1.5: You're going to have to change your way of looking at the problem since the approach you were using is based on a flawed premise.

Hint 2.5: Think about a lattice point on the left side of the arc between the top corners of the square. By symmetry there is another such point directly to the right of it and a third directly below. What can you say about the distance between these points and about the trangle they form?

Hint 3.5: How can you determine how many lattice points there are on the left side of the arc between the top corners of the square for any given n?