An algorithm for finding prime factors occurred to be while lying in bed this morning. I seem to've mislaid the mail suggesting this as a golf challenge, but this what I've come up with for 77: #! /usr/bin/perl $%=pop;$/=2;$%%$/&&$/++or$%/=$/,push@%,$/while$%>1;@%or@%=$%;$,=' x ';print@% Sample use: $ ./factors 84 2 x 2 x 3 x 7 Smylers