-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.pl
59 lines (47 loc) · 1.09 KB
/
search.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/perl
# Smallest prime p == 3 (mod 4) such that all of 2,3,5,...,prime(n) are primitive roots mod p.
# https://oeis.org/A350121
# Known terms:
# 3, 19, 907, 1747, 2083, 101467, 350443, 916507, 1014787, 6603283, 27068563, 45287587, 226432243, 243060283, 3946895803, 5571195667, 9259384843, 19633449763
# New term found:
# 229012273627
# Based on code by Dana Jacobsen (Jul 11 2018) from https://oeis.org/A213052
use 5.020;
use warnings;
use Math::Prime::Util ":all";
my ($N, $A, $p, $a, @P7) = (10**13, 2);
forprimes {
$p = $_;
if ( $p % 4 == 3
and is_primitive_root(2, $p)
and ($A < 3 || is_primitive_root(3, $p))
and ($A < 5 || is_primitive_root(5, $p))
and ($A < 7 || vecall { is_primitive_root($_, $p) } @P7)
) {
say $p;
$A = next_prime($A);
push(@P7, $A) if ($A >= 7);
}
} 3, $N;
__END__
3
19
907
1747
2083
101467
350443
916507
1014787
6603283
27068563
45287587
226432243
243060283
3946895803
5571195667
9259384843
19633449763
229012273627
^C
perl search.pl 24073.43s user 43.05s system 98% cpu 6:46:45.00 total