1 min read

APL Hacking: Project Euler (#25)

Problem #25:

∇R←PETWENTYFIVE;I;A;X;⎕IO;B;D
⎕IO←1
⍝ What is the first fibonnacci term to contain 1,000 digits?
D←1000000000 ⍝ Use nine-digit numbers.
A←B←X←¯112↑1 ⍝ Need 112 9-digit numbers to get 1,000 digits.
I←2
LP:A←B ⋄ B←X ⋄ I←I+1 ⋄ X←⊃(D CARRY)/A+B ⋄ →(0=↑X)/LP
R←I
∇


This one is just brute force using my existing CARRY algorithm that you can see in my previous posts.