Stuart Breckenridge

The Collatz Conjecture

This short post on Daring Fireball regarding the Collatz Conjecture and Swift code in playgrounds piqued my interest. I thought I’d have a go at putting together a playground with full markup and graphs of the results. My code is available as a gist.

Note: Interestingly, I discovered that XCPlaygroundPage.currentPage.captureValue(value: T, withIdentifier: String) has been deprecated and there is no replacement. There is a basic for loop at the end of the playground which produces the graph.

— Supported by —