Throwback: Jan 2018.

I learned of Dismal Arithmetic from @rdivyanshu who posed it as a programming problem in a Slackroom of local gentlenerds.

As the linked paper describes it:

Dismal arithmetic is just like the arithmetic you learned in school, only simpler: there are no carries, when you add digits you just take the largest, and when you multiply digits you take the smallest. This paper studies basic number theory in this world, including analogues of the primes, number of divisors, sum of divisors, and the partition function.

I thought it might be fun to implement it in APL for kicks, but I wrote it in Clojure first, because I wasn’t sure of my APL-fu. And I’m glad I wrote the Dyalog APL version because I learned something about trains, and also because I stumbled on the idea of “inverse of a function” which melted my mind a bit.