Ahrens was born in Lübz at the Elde in Mecklenburg and studied from 1890 to 1897 in Rostock at Otto Staude, where he graduated summa cum laude. From 1895 to 1896 he taught at the German school in Antwerp and then studied another semester under Sophus Lie in Leipzig. In 1897 he was a teacher in Magdeburg on the Baugewerkeschule, from 1901 at the engineering school. Inspired by Sophus Lie, he wrote "On transformation groups, all of whose subgroups are invariant" (Hamburger Math Society Vol 4, 1902).
He worked a lot on the history of mathematics and mathematical games (recreational mathematics), about which he wrote a great work and also contributed to the Encyclopedia of mathematical sciences His predecessors were the great Jacques Ozanam in France, where the number theorist Édouard Lucas (1842–1891) in the 19th century wrote similar books, and Walter William Rouse Ball (1850–1925) in England (Mathematical recreations and essays 1892), Sam Loyd (1841–1901) in the U.S. and Henry Dudeney (1857–1930) in England. In this sense Martin Gardner (1914-2010) and Ian Stewart, the editor of the math column in Scientific American, might be regarded as his successors. He also wrote a book of quotations and anecdotes about mathematicians. He was the author of numerous journal articles.
- Mathematische Unterhaltungen und Spiele [Mathematical Recreations and Games], 1901
- Mathematische Spiele [Mathematical Games], 1902
- Scherz und Ernst in der Mathematik; geflügelte und ungeflügelte Worte [Fun and seriousness in Mathematics], 1904
- Gelehrten-Anekdoten [Scholarly anecdotes], 1911
- Mathematiker-Anekdoten [Anecdotes of Mathematicians], 1916