/
prog.sf
52 lines (40 loc) · 1.12 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/ruby
# a(n) is the least k such that sigma(k) is a Fibonacci number when k is the product of n distinct primes, or 0 if no such k exists.
# https://oeis.org/A290936
# Known terms:
# 2, 94, 66, 19290, 2000006490, 247917529768610, 276320525457530886869600795810
# a(7) > 1709943212167773357407100
# a(7) = 276320525457530886869600795810
# Lower-bounds:
# sigma(a(8)) >= fibonacci(240)
func a(n, from=1) {
for k in (from..Inf) {
say "[#{n}] Checking k = #{k}"
var arr = k.fib.inverse_sigma
with (arr.first_by { .is_squarefree_almost_prime(n) }) {|v|
return v
}
}
}
var n = 8
var from = 240 # requires more than 6GB of RAM
say "a(#{n}) = #{a(n, from)}"
#~ for n in (8) {
#~ var v = a(n)
#~ say "#{n} #{v}"
#~ }
__END__
1 2
2 94
3 66
4 19290
5 2000006490
6 247917529768610
7 276320525457530886869600795810
[7, 276320525457530886869600795810]
[7, 277036896340045639450458794690]
[7, 278062077795208406914509455810]
[7, 278069492041326495002531471810]
[7, 283788647210397460193342594210]
[7, 284516793112050600413768772290]
[7, 285577268526665078125073654210]