-
Notifications
You must be signed in to change notification settings - Fork 0
/
carmichael_lcm_factor_is_carmichael.pl
executable file
·204 lines (167 loc) · 27.5 KB
/
carmichael_lcm_factor_is_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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
#!/usr/bin/perl
# Generate new Carmichael numbers of the form lcm(a,b),
# where a,b are both B-smooth Carmichael numbers, for some small B.
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 $carmichael_file = "cache/factors-carmichael.storable";
my $carmichael = retrieve($carmichael_file);
my %table;
sub my_carmichael_lambda ($factors) {
Math::Prime::Util::GMP::lcm(map { Math::Prime::Util::GMP::subint($_, 1) } @$factors);
}
# 3, 5, 17, 23, 29, 53, 83, 89, 113, 197, 257, 353
#my $divisible = vecprod(3, 5, 17, 23, 29, 53, 83, 89, 113);
my $divisible = vecprod(3, 5, 17, 23, 29, 53, 83, 89, 113, 197, 257, 353);
#my @c = grep { (split(' ', $carmichael->{$_}))[-1] <= 1e3 } keys %$carmichael;
my @c = grep { Math::Prime::Util::GMP::modint($_, $divisible) == 0 } keys %$carmichael;
foreach my $n (@c) {
say $n;
}
say "# Total: ", scalar(@c);
#my @factors = (3, 5, 17, 23, 29, 53, 83, 89, 113, 149, 173, 197, 263, 269, 293, 359, 383, 593, 617, 947, 1049);
#my @factors = (3, 5, 17, 23, 29, 53, 83, 89, 1049);
#my @factors = (3, 5, 17, 23, 29, 53, 83, 89, 113, 149, 173, 197, 257, 353, 419, 449, 593, 617, 677, 683, 947, 1217, 1373, 1409, 1559);
#my @factors = (113, 197, 257, 353, 449, 617, 1409, 2003, 2297, 2549, 3137, 3329, 4019, 9923);
#my @factors = grep { gcd($_, $divisible) == 1 } (3, 5, 17, 23, 29, 53, 83, 89, 113, 149, 173, 197, 263, 269, 293, 359, 383, 593, 617, 947, 1049, 1433, 1607, 1877, 2003, 2237, 2297, 2549, 3257, 3407, 3527, 3797, 4019, 4817, 4967, 5897, 5987, 7253, 7877, 8009, 8429, 10193, 11243, 13469, 16073, 16427, 18617, 18719, 19163, 20879, 21977, 23057, 24683, 25457, 26489, 26573, 29009, 32579, 33617, 33713, 34763, 38459, 39443, 39887, 41903, 44549, 49193, 50513, 52529, 54539, 66749, 72227, 74873, 74933, 75629, 76649, 77573, 80669, 88397, 92723, 93809, 95369, 97553, 98729, 98939, 104537, 107603, 109253, 118163, 126023, 136949, 140009, 140453, 148667, 157769, 161459, 172199, 172283, 195203, 203279, 205493, 213539, 220529, 228203, 237689, 247853, 248639, 257399, 266993, 302513, 310949, 314777, 315449, 320867, 338669, 361373, 381629, 426389, 459929, 467237, 483407, 535529, 544727, 561809, 569579, 574949, 602603, 613493, 645833, 649499, 652913, 656657, 667577, 671609, 692567, 716633, 780809, 823967, 877073, 887483, 902357, 912809, 938939, 944969, 958637, 991409, 1008437, 1017329, 1029593, 1031399, 1100543, 1104377, 1117169, 1205387, 1219349, 1243793, 1280567, 1439429, 1450073, 1536107, 1683089, 1715099, 1750979, 1774697, 1943537, 1999817, 2098097, 2110769, 2176637, 2239667, 2252273, 2278313, 2316497, 2370677, 2431049, 2537627, 2672363, 2703317, 2911679, 2984717, 3008633, 3105719, 3219497, 3270653, 3365009, 3470897, 3499679, 3591017, 3611147, 3652937, 3671669, 3703109, 3755753, 3801029, 3829169, 3932657, 4033229, 4053869, 4125593, 4303613, 4344689, 4402169, 4877393, 5080967, 5265107, 5387729, 5407403, 5418947, 5662757, 5753777, 5922533, 6201497, 6273329, 6284279, 6285137, 6628847, 6882149, 7408127, 8206889, 8395817, 8535437, 9146609, 9162653, 10570457, 10689449, 10752743, 10817687, 10998989, 11229737, 11671577, 11781617, 11983973, 12422873, 12576587, 12612503, 13459727, 13998713, 14608907, 14690957, 15412937, 15677663, 16169297, 16415939, 16647359, 17610737, 18093197, 19407389, 19490417, 19953389, 20068049, 21089993, 21413393, 22172177, 24296273, 25497737, 25570553, 26380157, 26825657, 27590333, 28236209, 28705769, 29363153, 29780339, 30603959, 30815177, 30818789, 32884853, 33773897, 34675439, 35293457, 36013433, 36496643, 37641137, 37714097, 38161727, 38801309, 38950493, 39112217, 39167129, 39842489, 41800529, 42276053, 42518477, 43410473, 45115877, 46705397, 46944899, 47145737, 48733049, 50450009, 51239189, 51831599, 52320269, 53483057, 55417979, 56790413, 58137509, 59748053, 61116329, 61186679, 61763549, 61853093, 62790659, 63753509, 64193669, 64397243, 69882317, 75692849, 76553933, 77661299, 81468377, 82471313, 85992089, 87715013, 88731017, 90218129, 93892163, 96305639, 98841653, 102262343, 109132817, 111435377, 120244433, 120501137, 121946969, 122570813, 123275153, 123808439, 126652373, 128828807, 130987949, 131539409, 136724177, 140572433, 140638037, 145834613, 147422969, 150636377, 151730489, 153161009, 163962527, 169483469, 170020943, 170052149, 178484153, 178983533, 180551537, 184661093, 185756429, 192300989, 195011909, 195082427, 197628173, 198073877, 200368169, 204956753, 209281073, 210876989, 212889713, 215706233, 215731517, 217578797, 223311089, 227343689, 232518287, 235023209, 239267309, 244746713, 247054193, 248137319, 255014033, 256554257, 258166679, 263613659, 264772223, 274755209, 288144893, 294979829, 301076777, 306215729, 307708259, 323201033, 326464469, 335551217, 340192007, 351972713, 352762103, 358000469, 362821187, 366241877, 374381393, 376872329, 379404653, 384352739, 385222553, 404642213, 411346769, 411676409, 421046627, 458814929, 464970353, 465160499, 465333683, 476867249, 483905759, 489568223, 500779709, 500808617, 506816663, 509414669, 523880267, 523951793, 531395999, 534351533, 540529523, 543629087, 549861497, 555033893, 562376963, 576766139, 578768219, 601944617, 603224987, 614425109, 615952247, 616373603, 635577713, 655129619, 662756249, 695279729, 746826809, 784950167, 789691079, 804090197, 820761899, 832341329, 833801333, 876697589, 906869657, 924875459, 946055813, 984409427, 986878283, 991754513, 997987607, 1078602449, 1099470269, 1109900177, 1144469327, 1152579569, 1153368017, 1173177773, 1177702577, 1230833033, 1263244529, 1342033169, 1346106917, 1348482539, 1368492287, 1393386479, 1402577177, 1452277529, 1491247409, 1493850359, 1563177617, 1569355607, 1584796907, 1656425189, 1674871157, 1726954769, 1755673529, 1773627857, 1795879793, 1807166747, 1828294469, 1861334729, 1935849917, 1984409753, 2014094237, 2060979509, 2064858797, 2070037373, 2174261489, 2199145733, 2211756317, 2249507849, 2311721369, 2323254347, 2353872977, 2443944647, 2523159299, 2526844433, 2536071539, 2552358569, 2561850149, 2585645693, 2596373627, 2659432049, 2690469167, 2767566257, 2800635377, 2843385917, 2848737893, 2972563943, 3052686407, 3059203439, 3211293653, 3211704497, 3225407069, 3236575343, 3264289703, 3265114217, 3409493909, 3512941589, 3583364753, 3656719067, 3658969073, 3805403603, 3887895029, 4037914193, 4039840619, 4060514459, 4169522897, 4271485037, 4397881073, 4422496079, 4460365319, 4502417789, 4518364493, 4577291699, 4585907327, 4587650393, 4760586377, 4801913429, 4846554077, 5043035999, 5112953873, 5115446249, 5193531419, 5263880777, 5312467253, 5464068689, 5517831089, 5612602997, 5964175337, 6363640973, 6774509897, 6877919987, 7066349837, 7106955857, 7215440597, 7466170193, 7479698297, 7507078517, 7674818537, 7763716049, 7802448557, 8011285283, 8073576113, 8126315033, 8262510257, 8291191217, 8500684583, 8667868793, 8702827277, 8813140337, 8936355737, 9452630279, 9531892217, 9998372213, 9999651377, 10092637193, 10799993177, 10985489243, 11690711957, 11789305529, 12158728583, 12698092457, 12732900797, 12845174609, 12973838879, 13357743257, 13579878677, 13637975633, 13711908719, 13723689167, 13897644377, 14353256303, 15077704643, 15551580113, 15883252109, 16030909637, 16242057833, 16625200307, 17107612523, 17210938427, 17662115087, 17689984313, 17932951037, 18174615383, 18616024337, 19066499453, 19207653713, 20347260077, 20566461329, 21051433547, 21249869009, 21616319957, 22208528057, 23054212637, 24834016439, 25454563889, 25751633447, 26656047419, 27215265197, 28117649003, 28318586759, 29043156143, 29708266589, 30095947337, 30978649703, 31745840309, 32101351283, 32307510953, 32802964349, 33613393997, 33942835697, 34976099159, 35099977823, 36408259889, 38248480817, 38694862823, 39668701073, 39908290577, 41630340137, 42312302033, 43574995313, 43811220539, 45082487507, 45318897443, 47827222829, 49212181019, 50348416889, 50382858857, 53619702749, 53723729753, 54346012337, 56151888497, 57085678217, 58637485523, 59399962469, 60919790933, 62664216539, 63897326417, 65831519867, 66108670937, 66723245513, 69997559633, 70958955497, 71832512753, 72825981383, 72853095239, 74363311793, 74494548857, 74689332719, 76693518749, 79347711059, 79358544497, 79696438823, 80177786327, 81521548109, 81834983693, 91365384419, 92261834897, 93504202793, 93972670793, 94788455477, 95983361027, 98128036997, 98265804869, 102388133849, 103754697593, 105943786313, 111182764757, 111820321229, 119005349009, 120809225993, 122265594389, 123634805603, 123914598809, 124178172119, 126514205777, 126798169499, 128553210479, 135298605443, 137909673617, 144315173003, 144861911897, 147856067633, 148115420909, 148749083057, 150734692109, 151979255429, 156256858577, 159078578777, 166589458157, 169318421273, 171643959917, 171832727249, 172198225109, 173630310257, 175584872849, 178181947217, 178407959159, 180646265507, 180669376889, 187549135229, 189511131317, 193428143273, 201330952397, 202485446549, 204446382449, 204966630347, 206899062437, 207666310853, 207957866117, 210366644489, 211119741743, 214478810993, 228436091837, 229607496119, 229942843313, 231938996537, 232264629689, 234794337233, 236269999967, 250534739729, 250656866153, 250974200933, 260310895349, 264483379577, 267739365713, 273103749689, 279954421937, 280979224457, 284762799413, 291412380953, 292227722333, 295750559399, 296307237227, 298085946929, 298757330873, 306717779369, 315577412543, 321728199677, 323063061179, 324659336849, 327339934769, 350261772953, 353302424957, 357651839273, 365842339409, 369694682897, 379841408519, 390368082833, 415216789373, 419409329879, 426072480653, 435592749593, 436204304537, 441256864049, 447526156463, 472611359039, 479013150617, 494539222409, 496712688473, 502122629009, 504107117879, 507340622567, 520168975217, 521461841993, 525062061833, 569723282129, 598735834313, 599603873849, 602938768433, 611505206159, 643359244529, 645517953809, 678714284249, 704902921493, 713631836633, 734995874159, 741073379177, 762287311787, 796740515429, 800816400203, 809941786193, 831725055869, 833607301073, 853104353333, 867402191657, 869247204827, 918429984473, 941175031889, 965367715313, 966723053297, 970847527469, 981421502153, 1017932157929, 1113550051433, 1170256403429, 1188201451529, 1201507719413, 1210093891889, 1262309650169, 1291368854777, 1292252244713, 1295000937803, 1326577919213, 1380358105127, 1409316666773, 1410446047583, 1485349985549, 1642972738793, 1648183011749, 1663879101347, 1724835323513, 1769505098219, 1831099388273, 1841941632389, 1894685249843, 2010802456433, 2017179208409, 2171847619397, 2194717315253, 2278314978353, 2487015587057, 2529753241289, 2627365434653, 2658889859627, 2687534108729, 2689687811669, 2830755354239, 2841252707567, 2874162970589, 3084467578193, 3097810927199, 3133110804209, 3204423929477, 3239921399807, 3419675816789, 3549932640689, 3788360952377, 3921832271897, 4075903585469, 4126080975017, 4127284524119, 4281120869873, 4429280952713, 4523565865079, 5004185292107, 5058095434169, 5109168200333, 5109821853137, 5194796717657, 5306311676849, 5397818261837, 5420911016753, 5511059204393, 5941399942193, 6020004359513, 6762196677809, 6795932692277, 6939318003437, 7973358383537, 8023470272819, 8741989998743, 9486594279317, 10182610113677, 10397449898837, 10911609509219, 11323021416953, 11698342153499, 11878676775473, 12565792060277, 12745954883663, 12746064408029, 12971465647229, 13834312586069, 14812993771493, 14903661768689, 15061256236937, 15159640692197, 15192004273109, 15411741147167, 15539912767913, 15686423573393, 15714846119897, 15947284275833, 16057385772473, 17320471785233, 18094263460313, 18193404783527, 18827814681677, 19233095251217, 21358645604297, 24630908247947, 29296924161737, 31664961055547, 32651533798577, 35768752971953, 36260026258457, 37377629807519, 39040285255973, 39492489332297, 40498211145809, 40552216237457, 41657511083189, 44991704962667, 45388424477369, 46167996653507, 46705457056217, 50143426904957, 50724238799609, 53632766112017, 59251975085969, 59850256061033, 63058727136497, 65690690554259, 77632496153213, 78297252792173, 79035441850553, 82836909303149, 83673332845103, 87262587081353, 90800259530597, 95215003525643, 99438762022937, 100590562355249, 100766141674199, 106117484845373, 121996996743623, 123410089369997, 126259444293137, 130563743530403, 142256019070439, 149510519230073, 160214364013397, 162899520952169, 165781658515793, 166630044332753, 187149531064217, 188913982959857, 192158688774053, 208578866682257, 214347428683697, 214618795254137, 246254106999209, 250201277078897, 253820183809193, 276447425326073, 311190499327709, 314941934738663, 341235788288273, 355069671597257, 365305526323739, 410343193952693, 424760307599057, 464934306230213, 522254974121609, 570300260202443, 677881316717333, 743330538298349, 798877102751729, 839559069522713, 946057048743353, 962963821399889, 1030394948942633, 1032586656860123, 1153976432691083, 1159891861130549, 1180403373897749, 1200033141756359, 1361593325388479, 1446615294172049, 1747454342378669, 1788361382599793, 1859737224920849, 2155161560705297, 2432943903834809, 2485487701180793, 2557138684266167, 2786516572888049, 3014444232498623, 3129632419549637, 3284394462274619, 3359609602632053, 5203313768088437, 5446373301553913, 5715699453828557, 7192225208400233, 9216939433398929, 13137577849098473, 18264693226759409, 30277759268929649, 41631918994778267, 44180811994458569, 143291256075050777, 199501400114454257, 300562146889130897, 520128650298398597, 894969968111210993, 1222897895358066929, 2164859787728469833);
my @factors = grep { gcd($_, $divisible) == 1 } (
3, 5, 17, 23, 29, 53, 83, 89,
113, 149, 173, 197, 257, 353, 419, 449,
593, 617, 677, 683, 947, 1217, 1373, 1409,
1559, 1613, 2003, 2129, 2237, 2297, 2357, 2543,
2549, 2729, 2753, 2927, 3137, 3257, 3329, 3527,
3719, 4019, 4733, 4817, 5333, 6449, 6689, 6917,
7253, 7547, 7937, 8009, 8429, 8513, 8867, 9473,
9857, 10169, 10193, 12959, 13469, 13859, 14897, 15137,
15467, 15809, 16073, 16493, 17837, 18353, 20483, 21737,
22877, 23297, 24683, 25013, 25457, 25793, 26489, 29009,
29327, 32117, 33713, 38039, 39443, 39887, 42533, 43649,
44549, 45137, 46817, 48299, 48413, 49193, 50513, 52289,
56417, 58997, 66749, 68993, 69317, 76343, 77573, 78737,
78989, 81017, 81929, 85313, 88397, 89909, 93809, 97007,
98729, 99713, 100049, 100937, 105953, 108263, 115259, 116273,
120737, 120917, 133673, 137567, 140009, 148667, 149297, 157769,
169313, 169937, 179969, 193649, 196769, 202049, 203057, 207329,
221729, 223697, 224813, 231323, 233663, 239933, 250433, 263303,
266993, 279203, 285377, 293633, 305369, 320867, 328043, 359633,
365639, 375233, 381239, 416417, 417089, 417509, 429599, 433049,
445589, 464129, 465089, 467237, 475229, 512747, 548417, 552917,
573497, 584897, 586769, 602603, 608609, 634943, 638177, 640529,
656657, 658379, 665039, 673817, 709157, 728729, 733409, 765143,
774593, 789137, 806807, 880727, 886913, 896897, 962963, 964517,
1008437, 1055489, 1062557, 1104377, 1109057, 1116809, 1130273, 1179179,
1189553, 1225589, 1236467, 1259777, 1268213, 1312169, 1359233, 1377377,
1394753, 1473869, 1500929, 1508417, 1524953, 1565873, 1620929, 1715099,
1718393, 1732193, 1875833, 1934657, 1940849, 2119937, 2209169, 2228777,
2268449, 2316497, 2404733, 2434433, 2440817, 2475089, 2524289, 2787149,
2908049, 2914913, 2933633, 2966657, 3031337, 3037607, 3041039, 3060569,
3067793, 3119117, 3270653, 3430337, 3461459, 3470897, 3652937, 3748397,
3801029, 3817217, 3900359, 4044323, 4053869, 4260257, 4271873, 4287617,
4405493, 4476473, 4758209, 4885889, 4902353, 4989377, 5268017, 5304839,
5754113, 5850209, 5915339, 6003089, 6165083, 6232799, 6263489, 6483713,
6542537, 7280417, 7376513, 7833827, 7932653, 7971713, 8044037, 8052353,
8579117, 8655263, 9185177, 9641633, 9946847, 10058819, 10159073, 10317077,
10558913, 11148593, 11280413, 12509183, 12901799, 12908897, 12929729, 13528607,
13585937, 14356889, 14572013, 14804609, 15355649, 15432257, 15895127, 16074059,
16177289, 16377089, 16685033, 17351447, 17621969, 17670017, 17778377, 18386369,
19350689, 19510037, 19772579, 19783457, 19824377, 20291393, 20356337, 20616179,
20766593, 20994689, 21050303, 21423977, 21710417, 21833813, 22095809, 23231339,
23286173, 23661353, 24012353, 24296273, 24385817, 25053953, 25150529, 25570553,
25825409, 26998583, 27062309, 28236209, 28377077, 28517633, 29262017, 29751569,
30765827, 31730609, 32586863, 34146113, 34235657, 34752257, 35038433, 36720503,
37063937, 37993229, 38137217, 38968697, 40548509, 41474189, 42235649, 42518477,
42562433, 42675179, 42698657, 44154293, 44594369, 44748467, 45797753, 48114977,
48601697, 49905857, 52523297, 53168039, 58074017, 58150793, 59912399, 60518459,
61317257, 66740129, 67332497, 68342849, 68484209, 72219533, 73185113, 76641137,
78252929, 79425473, 90312587, 90362273, 94165787, 96692597, 99724769, 100498217,
100924097, 103124477, 104572469, 107305199, 107489537, 107994329, 111265883, 119407289,
128896457, 132067937, 134121989, 140638037, 146882009, 146962817, 147504449, 154336547,
160941089, 164449979, 167280257, 189436157, 194626433, 202818617, 203851649, 204391643,
206428769, 210801137, 212672153, 221011649, 222114257, 225568799, 232603169, 233152193,
239649593, 242073833, 243265793, 249622913, 259447553, 281951489, 298726247, 305407103,
306910913, 307368473, 315851537, 317701889, 324105497, 340211873, 341104037, 345893549,
349692773, 372176267, 372578753, 379192577, 381731813, 388740353, 390173057, 398899073,
406399709, 418289873, 418913483, 419820353, 423629207, 445063529, 451732373, 502679633,
511089437, 521389793, 547770497, 553936769, 567184619, 596994113, 622825589, 638100737,
652012817, 659160503, 680295617, 682802849, 703487513, 732764033, 764470169, 792687113,
857311313, 872529857, 884046593, 905162987, 932608769, 958598369, 984466253, 1001305397,
1058529473, 1060237697, 1091123489, 1095747329, 1138335563, 1155512513, 1156676093, 1195562369,
1307827457, 1318072757, 1319435393, 1347219329, 1360847489, 1387202447, 1426961537, 1457826833,
1465252097, 1472133209, 1475607953, 1490315009, 1521624833, 1526927249, 1622243393, 1628222177,
1649991617, 1675653929, 1716883169, 1721564417, 1731987713, 1800294497, 1806929489, 1828294469,
1949581817, 2156657777, 2185124033, 2219109257, 2250208577, 2279909633, 2569494929, 2636642009,
2654348033, 2731211393, 2799690167, 2835722033, 2838925937, 2887485329, 2965404443, 3057880673,
3115444697, 3231404177, 3270266273, 3332175617, 3341565683, 3372818177, 3445772513, 3656738177,
3989841857, 4157781629, 4234117889, 4255241537, 4553342249, 4886513633, 4917895553, 5142799313,
5654957309, 5694405377, 5831307329, 5872520837, 5954820257, 6107708993, 6127257137, 6319401089,
6336140903, 6399291809, 6571977413, 6702615713, 6799760969, 6959947457, 7637864417, 7670231297,
8115843737, 8368936577, 8551398857, 8583807233, 8606317217, 8740496129, 9827483849, 9965209409,
10277979713, 10502063573, 10524798593, 10688490737, 11052871103, 13197169217, 13373616257, 13422904769,
14005159169, 14798362307, 16450784897, 17152660097, 17285693153, 17612928257, 17986464497, 19353165833,
20538053537, 21166888289, 22028718713, 22195239137, 24876796673, 25263705377, 27792046283, 27970530953,
28036551089, 28910871809, 31193309057, 32386930577, 33491030483, 36299815553, 36864386417, 38550257747,
42008254289, 44211484409, 45516767297, 46509138677, 47446471073, 49847115137, 50351357057, 51945271769,
53691619073, 57242016833, 60244220513, 63932642177, 64512676229, 66524506049, 68539783313, 70949639489,
79400216897, 79654342769, 84667553153, 91927537703, 97555754297, 100173529457, 105257524373, 108796175489,
111168185129, 111589494017, 120068620673, 123290497793, 129195458393, 170722570019, 171015851777, 176845937633,
182975386049, 195281614529, 217283270933, 251591155817, 283798557953, 348929805953, 351629531969, 425226410753,
488295260993, 496647476417, 535856487713, 672132068609, 682890280073, 701214706193, 869133083729, 937748853497,
972652656977, 985490938433, 1076865441653, 1197110962433, 1366971301697, 1684120389953, 1919113932737, 2223206073089,
3459274314497, 6347838392897, 9277609958849, 13999250741477, 21928896266369, 24214920201473, 50577938162753, 145852658887937,
202311752651009, 223988011863617, 391979020761329
);
@factors = grep { $_ < 1e6 } @factors;
my $factor = Math::Prime::Util::GMP::vecprod(@factors);
my $k = 3;
say "# Combinations: ", binomial(scalar(@factors), $k);
forcomb {
my $f = Math::Prime::Util::GMP::vecprod(@factors[@_]);
#say "# Checking factor $f = prod(@factors[@_])";
foreach my $n (@c) {
my $c = Math::Prime::Util::GMP::lcm($n, $f);
if ( $c ne $n
and not exists $carmichael->{$c}
and Math::Prime::Util::GMP::is_carmichael($c)) {
say $c;
#say "Found: $c";
$carmichael->{$c} = 1;
}
}
}
scalar(@factors), $k;
__END__
foreach my $f (@factors) {
next if $f < 13469;
say "# Checking factor $f";
my $pm1 = $f-1;
foreach my $n(@c) {
my $c = Math::Prime::Util::GMP::lcm($n, $f);
if ( not exists $carmichael->{$c}
and Math::Prime::Util::GMP::modint(Math::Prime::Util::GMP::subint($c, 1), $pm1) == 0
and Math::Prime::Util::GMP::is_carmichael($c)
) {
say $c;
$carmichael->{$c} = 1;
}
}
}
__END__
foreach my $k(0, 1) {
say "# Testing with k = $k";
forcomb {
my $w = vecprod(@factors[@_]);
my $f = Math::Prime::Util::GMP::divint($factor, $w);
foreach my $n (@c) {
my $c = Math::Prime::Util::GMP::lcm($n, $f);
if (not exists $carmichael->{$c} and Math::Prime::Util::GMP::is_carmichael($c)) {
say $c;
$carmichael->{$c} = 1;
}
}
} scalar (@factors), $k;
}