APL Hacking: Project Euler Daily (#2)
Problem #2:
∇R←PETWO;X;⎕IO ⎕IO←1⍝ Find the sum of all even fibonacci numbers < 4,000,000
X←0 1
:Repeat
X←X,X[⍴X]+X[(⍴X)-1]
:Until X[⍴X]>4000000
R←+/(0=2|X)/X
∇
∇R←PETWO;X;⎕IO ⎕IO←1⍝ Find the sum of all even fibonacci numbers < 4,000,000
X←0 1
:Repeat
X←X,X[⍴X]+X[(⍴X)-1]
:Until X[⍴X]>4000000
R←+/(0=2|X)/X
∇