-
Notifications
You must be signed in to change notification settings - Fork 0
/
prog.pl
69 lines (53 loc) · 1.13 KB
/
prog.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
#!/usr/bin/perl
# Values of n such that 5^n ends in n, or expomorphic numbers relative to "base" 5.
# https://oeis.org/A306570
use 5.014;
use ntheory qw(:all);
#foreach my $n(408203125..8408203125) {
#my $n = $k * 5**14;
# my $n = int(rand(8408203125-408203125)) + 408203125;
# if (powmod(5, $n, 10**length($n)) eq $n) {
# say "Found: $n";
# }
#}
use Math::AnyNum qw(:overload);
my $t = 5;
for (1..20) {
foreach my $k(1..1e6) {
my $n = Math::AnyNum->new("$k$t");
if (powmod(5, $n, 10**length($n)) == $n) {
say $n;
$t = $n;
last;
}
}
}
__END__
8408203125, 18408203125, 618408203125, 2618408203125, 52618408203125, 152618408203125, 3152618408203125
8408203125
18408203125
618408203125
2618408203125
52618408203125
152618408203125
3152618408203125
25
125
3125
203125
8203125
408203125
8408203125
18408203125
618408203125
2618408203125
52618408203125
152618408203125
3152618408203125
93152618408203125
493152618408203125
7493152618408203125
17493152618408203125
117493152618408203125
7117493152618408203125
87117493152618408203125