I found the following quiz on G+, and decided to solve it with APL:

https://plus.google.com/108865431001865524379/posts/FKMrYkF6h3u

The solution I came up with was this:

*      (⍳N)⍪[1.5]{+/⍎¨⊃,/⍕¨⍳⍵}¨⍳N←400*

This creates a table showing the number of pages, and the sum of the digits
for that number of pages.

I was surprised that the program ran so slowly, taking almost a second to
finish on my (pretty fast) computer.

I'll follow up with profiler results, but I was wondering of anyone can
come up with a faster solution?

Regards,
Elias

Reply via email to