-
Notifications
You must be signed in to change notification settings - Fork 0
/
prog.sf
36 lines (28 loc) · 778 Bytes
/
prog.sf
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
#!/usr/bin/ruby
# a(n) is the smallest positive number k such that k^2 - 1 and k^2 + 1 each have n distinct prime divisors.
# https://oeis.org/A365326
# Known terms:
# 2, 5, 13, 83, 463, 4217, 169333, 2273237, 23239523, 512974197, 5572561567
# a(n) >= max(A219017(n), A180278(n)).
var lower_bounds = [0, 2, 4, 13, 47, 447, 2163, 24263, 241727, 2923783, 16485763, 169053487, 4535472963]
func a(n) {
#var min = n.pn_primorial.isqrt
var min = lower_bounds[n]
for(var k = min; true ; ++k) {
if (is_omega_prime(k.sqr.dec, n) && is_omega_prime(k.sqr.inc, n)) {
return k
}
}
}
for n in (1..20) {
say("a(#{n}) = ", a(n))
}
__END__
a(2) = 5
a(3) = 13
a(4) = 83
a(5) = 463
a(6) = 4217
a(7) = 169333
a(8) = 2273237
a(9) = 23239523