Determining the link betweem the grid size and k was also trival, the ring size is 2k+1. Hence for a 1001x1001 grid, k = 500. We can simply sum the answer over t=1..k+1 to get the solution, and add one for the central 1.
let fk k = 4*((2*k+1)^2-3*k) let s = 1 + (sum . map fk $ [1..500])
No comments:
Post a Comment