The Prime Factors Kata, as done by Uncle Bob using Test-Driven Development (TDD).
"The interesting question here is where the heck did that algorithm come from? Because I didn't design it up front, I didn't think it through up front, I didn't plan out a way to solve this algorithm. What I did was pose a bunch of test cases, and one by one I made those test cases pass and somehow this algorithm came out. I'll leave you to ponder that; it's one of the more interesting elements of test-driven development. Apparently, test-driven development is a way to incrementally derive solutions to problems. That doesn't mean we don't plan things, that doesn't mean we don't design things, that doesn't mean we don't do archetecture. What it does mean, however, is that we have a tool - a discipline - that supports incremental development of algorithms." - Uncle Bob