## APL Hacking: Project Euler (#30)

I figure it's about time I posted another Project Euler.Problem #30: ∇Z←PETHIRTY;M [1] ⍝ Find the sum of all the numbers that can be written as [2] ⍝ the sum of fifth powers of their decimal digits. [3] Z←+/1↓((⍳M)=+⌿(((1+⌊10⍟M)⍴10)⊤⍳M)*5)

## APL Hacking: Project Euler (#29)

Problem #29: ∇Z←PETWENTYNINE;⎕IO ⎕IO←1 ⍝ Compute the cardinality of the set ⍝ {ab | 2≤a≤100 ^ 2≤b≤100} ⍝ Easy to do by computing the sequence, ⍝ ordering it, and then removing duplicates. Z←⍴(-1⌽1↓(Z≠-1⌽Z),1)/Z←Z[⍋Z←,(1↓⍳100)∘.(1↓⍳100)] ∇Another easy one.

## 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

## APL Hacking; Project Euler (#27)

Problem #27: ∇Z←PETWENTYSEVEN;A;B;X;P ⍝ Find the product of the coefficients A and B ⍝ that have the longest consecutive n values from 0 ⍝ for the quadratic formula. ⍝ P is the prime table used by CONS∆PRMS. ⍝ Seed it with the primes we use for B since we

## APL Hacking: Project Euler (#26)

Problem #26: ∇Z←CYCLE∆LENGTH N;A;I;R ⍝ Find the length of the cycle of 1÷N. Z←0 ⋄ I←0 ⋄ A←N⍴0 ⋄ R←1 LP:I←I+1 ⋄ Z←I-A[R] ⋄ →(0≠A[R])/0 A[R]←I ⋄ R←N|R×10 ⋄ →(0=R)/Z←0 →LP

## 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←

## APL Hacking: Project Euler (#24)

Problem #24: ∇R←PETWENTYFOUR;N;A;I ⍝ Compute the 1,000,000th Lexicographic Permutation of ⍝ 0 through 9. N←10 →(N≥3 2 1)/C3,C2,C1 R←1 0⍴0 ⋄ →0 C1:R←1 1⍴⎕IO ⋄ →0 C2:R←2 2⍴⎕IO+0 1 1 0 ⋄ →0 C3:R←