Swift: 001
Swift: 002
Swift: 003

Runs in less than a second compiled, takes quite a while as a playground
Swift: 004