1 min read

APL Hacking: Project Euler (#28)

Problem #28:

Z←PETWENTYEIGHT
⍝ Sum of the diagonals of a 1001 by 1001 spiral
Z←+/+1,4/2×⍳500


This one is too easy to talk about. Basically, we can realize the nature of the spiral and the diagonals is easy to think about without generating the spiral.

On the other hand, what would it look like if we wanted to generate the spiral?