Posts Tagged ‘factoring’

Golfing with prime factors

Sunday, June 14th, 2009

Dirk-Jan reminded me of the Perl Golf and Code Golf contests, both of which have the aim of solving a simple programming task in as few characters of source code as possible. See his post for a stunning example.

One of the open challenges is to work out the prime factors of a given number. To make things a little more difficult, the output must be printed in a specific format:

7000: 2^3 5^3 7
123456789: 3^2 3607 3803

(more…)