-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathverify.sf
30 lines (22 loc) · 865 Bytes
/
verify.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
# a(n) is the least k such that k^2 + 1 is a semiprime p*q, p < q, and (q - p)/2^n is prime.
# https://oeis.org/A258780
# The corresponding primes are:
# 2, 3, 71, 7, 1069, 7, 5, 5, 59, 2, 368471, 180463, 12421, 2, 29, 125683, 226169, 5, 369704891, 197, 5, 263, 7444559, 239621423, 594271, 2, 474359, ...
[
8, 12, 140, 64, 2236, 196, 1300, 1600, 6256, 5084, 248756, 246196, 484400, 36680, 887884, 821836, 1559116, 104120, 126072244, 9586736, 4156840, 542759984, 1017981724, 2744780140, 405793096, 148647496, 1671024916
#~ 542759984
#~ 1017981724
#~ 2744780140
#~ 405793096
#~ 148647496
#~ 1671024916
].each_kv{|k,v|
var n = (k+2)
assert(v**2 + 1 -> is_semiprime)
var (a,b) = factor(v**2 + 1)...
assert((b-a) / 2**n -> is_int)
assert((b-a) / 2**n -> is_prime)
say [v, (b-a) / 2**n, n]
#print(b-a / 2**n, ", ")
}