-
Notifications
You must be signed in to change notification settings - Fork 0
/
extra-strong_lucas_not_lucas.pl
executable file
·88 lines (72 loc) · 1.8 KB
/
extra-strong_lucas_not_lucas.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
#!/usr/bin/perl
# Find extra-strong Lucas pseudoprimes that are not regular Lucas pseudoprimes.
# The first few terms are:
# 989, 3239, 27971, 29681, 30739, 31631, 125249, 137549, 137801, 153931
# See also:
# https://oeis.org/A217120 -- Lucas pseudoprimes
# https://oeis.org/A217719 -- Extra strong Lucas pseudoprimes
use 5.020;
use strict;
use warnings;
use Math::Prime::Util::GMP qw(
is_pseudoprime
is_lucas_pseudoprime
is_extra_strong_lucas_pseudoprime
is_almost_extra_strong_lucas_pseudoprime
);
my %seen;
while (<>) {
next if /^\h*#/;
/\S/ or next;
my $n = (split(' ', $_))[-1];
$n || next;
next if ($n < ~0);
#next if length($n) > 40;
is_pseudoprime($n, 2) && next;
is_lucas_pseudoprime($n) && next;
if ( is_extra_strong_lucas_pseudoprime($n)
|| is_almost_extra_strong_lucas_pseudoprime($n)) {
say $n if !$seen{$n}++;
}
}
__END__
# Some examples greater than 2^64:
21979710862205324399
31155533865320225759
32614974548912586599
46675503329187754391
47137357874632210499
68891633072323569191
110010529523011784831
181792908157826671439
187961990407258205591
204775845664488874991
206459139977493134399
206560670024345256791
206675382180674432759
294453521939438917439
298428222066624344999
336947701713570561239
513398368200012052799
557700139349287019399
798909849426402491399
# Some examples with more than 3 factors:
1441047407316299
757833929289202499
27292658179482499859
76400587170813605849
137534203921819545569
299651357354898181499
635873639357398391459
688263201326737424489
849911100465285007379
850047981592775523011
903938650523935653059
2319023344998942960299
2510072121079439620259
39383652460474120698899
84512947066721812244219
233535954319253909204699
432509954733989656647779
4904416886890491872853899
3039165753384639348162300649999