Thought I'd also have a go at translating ch-1.pl into C.. ch-1.c produces identical (non-debugging) output to my Perl original. ch-1.c uses the command-line argument processing module args.[ch]. The C version (ch-1.c) is approx twice as fast than even my fastest Perl version (ch-1g.pl). As a further optimization in ch-1a.c: let's pre-compute all the powers of digits: this runs about 30% faster than ch-1.c did.