This site is supported by donations to The OEIS Foundation.

# User:Dana Jacobsen

### From OeisWiki

Software engineer, doing number theory for fun in Perl and Python.

I have been developing the Math::Prime::Util and Math::Prime::Util::GMP modules, which can be used with Perl to create scripts similar to Pari. In most cases (with some exceptions) these run faster than Pari. Grossly so in the cases of prime counting and nth prime, and substantially so for primality testing of titanic numbers. Pari has a quality advantage of having more eyes on the code and much more daily use. I test against Pari and other software, but clearly there are still chances for defects.

I am unsure as to whether I should add Perl+MPU to the programs section of some pages, on sequences where it works very well.

Some of the things I've been working on:

* Pseudoprime Statistics, Tables, and Data -- standard, strong, almost extra strong, and extra strong Lucas pseudoprimes to 1e14. * Thomas Nicely's tables of prime gaps -- I have been running a number of searches, finding about 50 larger-merit gaps per day. * ECPP -- an ECPP implementation, latest version here. As far as I know, this is the fastest open source implementation, though significantly slower than Primo once over ~500 digits. * The ECPP software also includes a verifier that also works on Primo certificates. It is in use by FactorDB. * Primes in Arithmetic Progression Participating in a search for the minimal start AP20. * Doing verification of many record prime gaps, including BPSW verification of the gap and proofs of the endpoints with certificates submitted to FactorDB.

Some OEIS sequences I need to work on (where mpu = "perl -MMath::Prime::Util=:all -E")

* A058328 mpu 'foreach my $n (1 .. 30) { next if is_prime($n); $n = nth_prime($n) for 1..11; say $n; }' * A046145 mpu 'say join ", ", map { 0+znprimroot($_) } 0 .. 100' * A046147 mpu 'my $i=2; say $i++," ",$_ for map { $n=$_; $phi = euler_phi($n); grep { gcd($_,$n) == 1 && znorder($_,$n) == $phi } 1..$n-1 } 1..250;' * A046144 mpu 'for (1..91) { say defined znprimroot($_) ? euler_phi(euler_phi($_)) : 0 }' * A033949 mpu 'say join ", ", grep { !defined znprimroot($_) } 2..123' * A049035 mpu '$|=1; for (1..10) { print "$_ "; my $v = nth_prime(10**$_); print "$v "; say twin_prime_count($v); }' We can also take the start from Nicely or TOeS's tables and run primesieve -c2 from there. * A088973

#!/usr/bin/env perl use warnings; use strict; use Math::Prime::Util qw/:all/; $|=1; sub PIPS4 { nth_prime(nth_prime(nth_prime(nth_prime(nth_prime($_[0]))))); } sub piptwins4 { my($m,$n) = @_; for my $x ($m .. $n) { my($c,$p1,$p2) = (0,PIPS4($x),PIPS4($x+1)); #forprimes { $c++ if is_prime($_+2); } $p1, $p2; $c = twin_prime_count($p1,$p2); print "$c, "; } print "\n"; } piptwins4(1,1000);

* A007908 mpu 'my($n,$c)=(0,""); while (1) { $c .= ++$n; say "$n len:",length($c) if $n & 1; die "C($n is prime!" if is_prime($c); }'