Reply from On-Line Encyclopedia
./x.primes-2.ll.x primes 10000 | drop.pl 4 | xargs -n1 -i expr '{}' - 1 | xargs -n1 factor | perl -nlwe 'BEGIN{$f{2}=0}($a,$b)=/(.*):.* (\d+)/;$a++;$f{$a}=$f{$b}+1;END{print "$f{$_} $_" for(keys %f)}' | sort +0n +1n | perl -nwae 'BEGIN{$p="-1"}print if $p!=$F[0];$p=$F[0]'
Better is
./x.primes-2.ll.x primes 2000000 | drop.pl 4 | xargs -i expr '{}' - 1 | xargs factor | perl -nlwae 'BEGIN{$f{2}=0}($a=$F[0])=~s/://;shift@F;$m=0;for(@F){if($f{$_}>$m){$m=$f{$_}}}$f{++$a}=$m+1;END{print "$f{$_} $_" for(keys %f)}' | sort +0n +1n | perl -nwae 'BEGIN{$p="-1"}print if $p!=$F[0];$p=$F[0]'
First difference is at 239 (238: 2 7 17).
./x.primes-2.ll.x primes 2000000000 | drop.pl 4 | xargs -i expr '{}' - 1 | xargs factor | perl -nlwae 'BEGIN{$f{2}=0;$x=0} ($a=shift@F)=~s/://;$m=0; for(@F){if($f{$_}>$m){$m=$f{$_}}} $f{++$a}=++$m;if ($m>$x){print $a;$x=$m}'
No comments :
Post a Comment