-
Notifications
You must be signed in to change notification settings - Fork 0
/
carmichael_with_3_factors_p+1|n+1.pl
executable file
·81 lines (65 loc) · 1.68 KB
/
carmichael_with_3_factors_p+1|n+1.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/perl
# Carmichael numbers m that have at least 3 prime factors p such that p+1 | m+1.
# https://oeis.org/A329948
# It is not known whether any Carmichael number (A002997) is also a Lucas-Carmichael number (A006972).
use 5.020;
use strict;
use warnings;
use ntheory qw(:all);
use Math::Prime::Util::GMP;
use Math::GMPz;
while (<>) {
next if /^\h*#/;
/\S/ or next;
my $n = (split(' ', $_))[-1];
$n || next;
next if ($n < ~0);
next if length($n) > 35;
#is_smooth($n, 1e5) || next;
Math::Prime::Util::GMP::is_carmichael($n) || next;
$n = Math::GMPz->new($n);
my $inc = $n + 1;
my $k = scalar grep { $inc % ($_ + 1) == 0 } Math::Prime::Util::GMP::factor($n);
if ($k >= 3) {
say "$k: $n";
}
}
__END__
# Terms below 2^64:
9857524690572481
33439671284716801
96653613831890401
270136961300544031
528096456788419441
650643395658753601
710238404427321601
1822922951416158241
4011563714063821201
4525693104167627041
4631812281009523441
7049793086137296001
8605736094003523201
10449416165574628801
11175581620177915681
12746447178170148001
12769123623410580481
17705945296667070001
# Extra terms:
112063204636898630401
171864347319293434273
290511032565049956001
2433475541834218396801
5500350467752540752001
15766720433614895241601
702716905099325753679601
1641197929815383993299441
1694870871860587162176721
2352002136477575651201920801
12939435103076881117129002241
16921253986821645965065105921
100316367094716219646271183761
123702372517731523759641748755329
379305888565700146110687208821889
21424389954178567168694716161869094785
1267302465895414494311727362263836874081
6705723249444927031929382532702808317638047551685696855129161734440001