login
A303878
Consider the representation of some integer (>1) as the sum of distinct unit fraction (<1). The sum of these denominators is least.
0
2, 3, 4, 5, 6, 8, 9, 10, 15, 18, 20, 24
OFFSET
1,1
COMMENTS
Consider the representation of 1 as the sum of distinct unit fraction (<1). We can easily found the least sum of the denominators. The solution is 1 = 1/2 + 1/3 + 1/6.
EXAMPLE
Denominators | Sum
---------------------------------------------+-----
2, 3, 4, 5, 6, 8, 9, 10, 15, 18, 20, 24 | 124
2, 3, 4, 5, 6, 7, 10, 12, 14, 15, 20, 28 | 126
2, 3, 4, 5, 6, 7, 9, 12, 14, 18, 20, 28 | 128
2, 3, 4, 5, 6, 8, 9, 10, 12, 18, 24, 30 | 131
2, 3, 4, 5, 6, 7, 8, 12, 14, 20, 24, 28 | 133
PROG
(Ruby)
def partition(n, min, max)
return [[]] if n == 0
[max, n].min.downto(min).flat_map{|i| partition(n - i, min, i - 1).map{|rest| [i, *rest]}}
end
def f(n)
a = []
partition(n, 2, n).each{|ary|
sum = ary.inject(0){|s, i| s + 1 / i.to_r}
a << ary.reverse if sum.denominator == 1 && sum.numerator > 1
}
a
end
n = 1
a = []
while a == []
n += 1
a = f(n)
end
p a
CROSSREFS
Sequence in context: A256007 A324689 A280578 * A039170 A097624 A000398
KEYWORD
nonn,fini,full
AUTHOR
Seiichi Manyama, May 02 2018
STATUS
approved