Originally posted by garo
However the results are printed in a format that is different from what SoB expects. I wonder if anyone would write a script to convert the result format.
I've been planning to write that script for a long time, now I did it:
Code:
#! /usr/bin/perl
use strict;
use warnings;
my $resultsfile = 'results.txt';
open(RESULTS,$resultsfile) or die "Couldn't open $resultsfile.\n";
open(FACT,'>fact.txt') or die "Couldn't open fact.txt.\n";
while (<RESULTS>) {
if (m/^(\d+)\*2\^(\d+)\+1 has a factor: (\d+)/) {
print FACT "$3 | $1*2^$2+1\n";
}
}
close(RESULTS);
close(FACT);
It assumes that the results are actually written to results.txt, but that can be changed in line 6 (counting the blanks).