-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate_special_form.sf
57 lines (36 loc) · 1.17 KB
/
generate_special_form.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/ruby
# Composite numbers for which the harmonic mean of proper divisors is an integer.
# https://oeis.org/A247077
# These are composite numbers n such that sigma(n)-1 divides n*(tau(n)-1).
# Generate more terms of the form m*(sigma(m)-1), where sigma(m)-1 is prime.
# It seems that, if we take m = p * (p+2)^k, where p+2 is also prime, genetares terms of the sequence for some prime p and some positive k.
# Full credit to Chai Wah Wu for coming up with this approach (Feb 04 2021).
# PARI/GP isok(n) function:
# isok(n) = n > 1 && !isprime(n) && (n*(numdiv(n)-1)) % (sigma(n)-1) == 0;
func isok(n) {
sigma(n).dec `divides` n*tau(n).dec
}
assert(isok(22351741783447265625))
for p in (primes(200)) {
p+2 -> is_prime || next
for k in (1..2000) {
var m = (p * (p+2)**k)
var q = sigma(m)-1
q.is_prime || next
var t = m*q
if (isok(t)) {
say m.factor_exp
}
}
}
__END__
# Prime factorization of several such m:
[[2, 1], [3, 1], [13, 4]]
[[3, 1], [5, 13]]
[[3, 1], [5, 143]]
[[3, 1], [5, 623]]
[[3, 1], [5, 1423]]
[[5, 1], [7, 1]]
[[5, 1], [7, 127]]
[[5, 1], [7, 6595]]
[[101, 1], [103, 25]]