https://blog.firedrake.org/archive/2020/06/Perl_Weekly_Challenge_66__dividing_and_factorising.html