-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathabundant_lucas-carmichael.pl
110 lines (85 loc) · 3.87 KB
/
abundant_lucas-carmichael.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/usr/bin/perl
# Lucas-Carmichael numbers k that have sigma(k)/k higher than all smaller Lucas-Carmichael numbers.
# https://oeis.org/A????
# Terms:
# 399, 6304359999, 408598269695, 517270926095
# Most likely the next three terms are:
# 20203946790335
# 6401963975003135
# 20576473996736735
# The rounded values of sigma(k)/k are 1.604, 1.612, 1.666, 1.705, ...
use 5.020;
use strict;
use warnings;
use ntheory qw(:all);
use Math::Prime::Util::GMP;
use Math::GMPz;
use Math::GMPq;
use Math::MPFR;
my @numbers;
while (<>) {
next if /^\h*#/;
/\S/ or next;
my $n = (split(' ', $_))[-1];
$n || next;
$n =~ /^[0-9]+\z/ or next;
#next if $n > ~0;
#next if length($n) > 65;
#Math::Prime::Util::GMP::modint($n, (5 * 7 * 11 * 17)) == 0 or next;
#Math::Prime::Util::GMP::is_carmichael($n) || next;
is_square_free($n) || next;
if ($n > ~0) {
$n = Math::GMPz->new($n);
}
(vecall { (($n + 1) % addint($_, 1)) == 0 } factor($n)) || next;
push @numbers, $n;
}
@numbers = sort { $a <=> $b } @numbers;
my $max = 0;
foreach my $n (@numbers) {
#say "Testing: $n";
my $t = Math::GMPq->new(0);
my $sigma = divisor_sum($n);
Math::GMPq::Rmpq_set_str($t, "$sigma", 10);
Math::GMPq::Rmpq_div_z($t, $t, Math::GMPz->new($n));
if ($t > $max) {
#if ($t > 1.9) {
#if ($t > 2) {
printf "%.4f abundancy: $n\n", Math::MPFR->new($t);
#say $n;
$max = $t;
}
}
__END__
1.6040 abundancy: 399
1.6121 abundancy: 6304359999
1.6661 abundancy: 408598269695
1.7057 abundancy: 517270926095
1.7517 abundancy: 20203946790335
1.7530 abundancy: 6401963975003135
1.8251 abundancy: 20576473996736735
1.8255 abundancy: 20904330094840610495
1.8309 abundancy: 777695624868402683135
1.8329 abundancy: 1398174113665704383855
1.8540 abundancy: 207108993941954571223295
1.8638 abundancy: 178710767382159698135049215
1.8766 abundancy: 562063860409115740951856735
1.9088 abundancy: 58979992549396611582730578815
1.9105 abundancy: 1256450412252191598280388500064045855
1.9237 abundancy: 11390100331508684997094302095712013055
1.9288 abundancy: 2079235058881599952187923810434730602142655
1.9576 abundancy: 3387807614071257013419037186520223378521855
1.9645 abundancy: 420007839480976895898895383276020020805254265855
1.9767 abundancy: 82231203994860465697985558283653994217300279496055935
1.9785 abundancy: 416877028260858744331628104581035632084215785203226466815
1.9820 abundancy: 11125769557604950361722055451149121092410811344786387967615
1.9841 abundancy: 20271697783823294260237852550938296900871404226278891615184895
1.9952 abundancy: 2639998728226905725115350331366399552110518127525284817708526335
1.9987 abundancy: 24310698014160010310749313013068622919013802712267027259077787135
2.0076 abundancy: 1012591408428327888883952080728349448745451794025524955777432246705535
2.0187 abundancy: 1252458644660264955837817577779489039780648512945893109814633472020085149868079698531417855
2.0213 abundancy: 2594145124305120505650019954091626919606128354602761434556536080738401442000096118992495759705889535
2.0217 abundancy: 48004480252852051285646070549127157890047486834077474187570451588852311338015732768562351620886252940556400392906811824917925622572444790546815
2.0243 abundancy: 787222305052394997724945516547365754011662300885413176469622073745477582640035495534105574008781335434719275080742355938058765385165632993837533689399387050916367220851560972415
2.0260 abundancy: 1120416428168792738913288328714108075486596731609500545277404161754024902457216989103636273073839624409271473732654088529349478546697842940188727574450221416527231767306447775225485495497262801144338725957373407467404701055
2.0273 abundancy: 460904006056686426887303849334911434365320374753443778612928069139740807299223897362251200121979223985201992131540581322922430436263834889072617722535515257096631290414859505532710437375649860660512051091130670806208295840255