OFFSET
0,3
EXAMPLE
1/1 + 1/1 = 2 and 2 is an integer.
1/1 + 1/2 = 3/2.
1/2 + 1/1 = 3/2.
1/2 + 1/2 = 1 and 1 is an integer.
So a(2) = 2.
PROG
(Ruby)
def A(n)
return 1 if n == 0
cnt = 0
(1..n).to_a.repeated_permutation(n){|i|
cnt += 1 if (1..n).inject(0){|s, j| s + 1 / i[j - 1].to_r}.denominator == 1
}
cnt
end
def A349146(n)
(0..n).map{|i| A(i)}
end
p A349146(6)
(Python)
from math import lcm, factorial, prod
from collections import Counter
from itertools import combinations_with_replacement
def multiset_count(x): return factorial(len(x))//prod(factorial(d) for d in Counter(x).values())
def A349146(n):
k = lcm(*range(2, n+1))
dlist = tuple(k//d for d in range(1, n+1))
return sum(multiset_count(d) for d in combinations_with_replacement(range(1, n+1), n) if sum(dlist[e-1] for e in d) % k == 0) # Chai Wah Wu, Nov 09 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
Seiichi Manyama, Nov 08 2021
EXTENSIONS
a(10)-a(23) from Alois P. Heinz, Nov 08 2021
STATUS
approved