Say I walked x miles on the first day. In the first week I will have walked 7x+21 miles. In the second week, 7x+70 miles. In the third week, 7x+119 miles.
These distances need to form a right angles triangle, so we can use Pythagoras Theorem:
(7x+21)^2 + (7x+70)^2 = (7x+119)^2
49x^2+294x+441 + 49x^2+980x+4900 = 49x^2+1666x+14161
49x^2-392x-8820=0
x^2-8x-180=0
(x+10)(x-18)=0
So the distance travelled on the first day was either -10 miles or 18 miles. Since the distance needs to be positive the answer is 18 miles. In total I walked 147+196+245 = 588 miles.
A shortcut to the solution would be to note that the difference between week 2 and week 1 is the same as the difference between week 3 and week 2: 49. So we are looking for a scaled up version of a primitive Pythagorean triple in arithmetic progression. Since 3,4,5 is the only such triangle we need only scale this up by a factor of 49 to find our distances.