Mathgen is a program to randomly generate professional-looking mathematics papers, including theorems, proofs, equations, discussion, and references. Try Mathgen for yourself! It’s a fork of SCIgen, a program which generates random papers in computer science.


Mostly because it’s funny! But there are some other possible uses:

  1. Impress your friends, colleagues and/or tenure committee with your prolific research output.
  2. Cheat on your Erdős number.
  3. As a way of producing something possibly worthwhile from this project, I am offering randomly generated books for sale via, and will donate $5.00 from each copy sold to the American Mathematical Society, in support of (actual, non-random) mathematical research. This would make a great gag gift for a mathematically inclined friend!
  4. A great way to come up with thesis topics for your grad students!
  5. More seriously, I think this project says something about the very small and stylized subset of English used in mathematical writing. This program only knows a handful of sentence templates, and yet I think its writing style is not far off from many published papers. You could argue this is bad (shows a lack of creativity) or good (makes papers more accessible to those with a limited knowledge of English), but I think we could stand to pay more attention to our writing styles, instead of unthinkingly relying on stock phrases.


Mathgen uses a handwritten context-free grammar, essentially starting from a basic template and filling in blanks with textual elements of various types. Those elements could in turn contain other blanks, so the process continues recursively.

The generator itself is written in Perl. The text is then processed by and BibTeX to produce the final output file.

The source code is available through Github.

If you don’t want to mess with Git, you can just get a zip file containing the code.

Mathgen is free software and released under the terms of the GNU General Public License, version 2.0.


Mathgen was written by Nate Eldredge, incorporating code from SCIgen, by Jeremy Stribling, Max Krohn, and Dan Aguayo, without whom this project would not exist.

Jordan Eldredge wrote most of the web interface (the parts that are slick and work well; the ugly awkward parts are mine).

A list of names of famous mathematicians, used in the program, was extracted from the web site The Greatest Mathematicians of All Time by James Dow Allen, and is used by permission. A list of countries and other place names was taken from Wikipedia.

blog built using the cayman-theme by Jason Long. LICENSE