-
Notifications
You must be signed in to change notification settings - Fork 0
/
carmichael_p==3_mod_80_cached.pl
executable file
·55 lines (37 loc) · 1.22 KB
/
carmichael_p==3_mod_80_cached.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
#!/usr/bin/perl
# Let p_1..p_k be distinct prime numbers and let n = p_1 * ... p_k.
# If the following conditions hold:
# a) k == 1 (mod 4) or k == 3 (mod 4)
# b) p_i == 3 (mod 80) for every i in {1..k}.
# c) (p_i-1) | (n-1) for every i in {1..k}.
# d) (p_i+1) | (n+1) for every i in {1..k}.
# Then n is a counter-example to Agrawal's conjecture.
# The only Carmichael number below 2^64 with all prime factors p == 3 (mod 80):
# 330468624532072027
use 5.020;
use strict;
use warnings;
use Storable;
use Math::GMPz;
use ntheory qw(:all);
use Math::Prime::Util::GMP;
use experimental qw(signatures);
my $storable_file = "cache/factors-carmichael.storable";
my $carmichael = retrieve($storable_file);
my @results;
while (my ($key, $value) = each %$carmichael) {
my $rem = Math::Prime::Util::GMP::modint($key, 80);
($rem == 27) || ($rem == 3) || next;
my @factors = split(' ', $value);
if (scalar(@factors) % 2 and vecall { Math::Prime::Util::GMP::modint($_, 80) == 3 } @factors) {
push @results, Math::GMPz->new($key);
}
}
@results = sort { $a <=> $b } @results;
foreach my $n (@results) {
say $n;
}
__END__
# Terms > 2^64:
1358406397003392026912594827
194462892367341977828363075381947