1 min read

APL Hacking: Project Euler Daily (#7)

Nothing much to say about this one. I use the basic prime sieve on this one. I am still playing with whether I like branch arrows or control structures better.

∇R←PESEVEN;X;N;⎕IO
⎕IO←1

⍝ The 10001st prime number.

N←150000 ⋄ X←N⍴1 ⋄ I←2
LOOP:X[I×1↓⍳⌊N÷I]←0 ⋄ I←I+(I↓X)⍳1 ⋄ →(N>I*2)/LOOP
X←X/⍳N ⋄ R←(1↓X)[10001]