-
Notifications
You must be signed in to change notification settings - Fork 0
/
prog.sf
30 lines (22 loc) · 1.2 KB
/
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
#!/usr/bin/ruby
# Class 1+ primes: primes of the form 2^i*3^j - 1 with i, j >= 0.
# https://oeis.org/A005105
# 2, 3, 5, 7, 11, 17, 23, 31, 47, 53, 71, 107, 127, 191, 383, 431, 647, 863, 971, 1151, 2591, 4373, 6143, 6911, 8191, 8747, 13121, 15551, 23327, 27647, 62207, 73727, 131071, 139967, 165887, 294911, 314927, 442367, 472391, 497663, 524287, 786431, 995327
# Primes p such that both p-1 and p+1 have the form 2^i*3^j*q with i,j >= 0 and q prime > 3.
# 29, 41, 43, 59, 61, 67, 79, 83, 89, 103, 113, 137, 157, 167, 173, 179, 223, 227, 233, 263, 269, 271, 277, 283, 313, 317, 347, 353, 359, 367, 397, 457, 467, 479, 503, 523, 541, 557, 563, 593, 607, 613, 641, 653, 673, 719, 733, 757, 773, 787, 809, 823, 877, 887, 907, 977, 983, 997
# Primes p such that both p-1 and p+1 have the form 2^i*5^j*q with i,j >= 0 and q prime != {2,5}.
# 13, 23, 29, 47, 59, 61, 149, 151, 191, 193, 383, 479, 751, 1201, 2999, 4799, 9601, 12289, 15361, 786431, 1199999, 6144001
func isok(n) {
n = n.remove(2).remove(5)
n.is_prime
}
for k in (1..1e7) {
if (k.is_prime) {
var pm1 = k.dec
var pp1 = k.inc
if (isok(pm1) && isok(pp1)) {
print(k, ", ")
#say k
}
}
}