1 min read

APL Hacking: Project Euler (#29)

Problem #29:

∇Z←PETWENTYNINE;⎕IO
⎕IO←1
⍝ Compute the cardinality of the set
⍝ {a*b | 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. I think they are going soft on me. Or maybe they are just doing problems for which APL seems to be designed.