The best way to "programatically redirect these links and keep [your] .htaccess file clean" would actually be with a plugin. I know you stated "without using a plugin," but you'll get the same functionality from a plugin that you would if you wrote the code yourself. And, considering how non-user-friendly the WP rewrite scripts are, I strongly suggest you don't try to write it yourself (I'm an experienced WP developer and I still have trouble with the clanky rewrite engine).
So if you're willing to go with a plugin, I recommend Redirection.
Redirection has a very intuitive UI that allows you to create, display, and manipulate all of your custom redirects. It also keeps track of any 404 errors your site generates by mistake. I use Redirection on my site to redirect legacy links from my ancient static site to the new dynamic WordPress links. I've also used it on several client sites after helping them migrate to WordPress.