login
A378842
Number of compositions (ordered partitions) of n into reciprocals of positive integers <= n.
3
1, 1, 5, 154, 127459, 1218599617, 2319241469466200, 32824171395278825785183, 115384552858168166552304749413033, 22529589324775724210737089575811718669447945, 1255772217551224641521320538899160332818484462756697922572, 885355014578065534254256068634855343582928219947780981811219956595305584
OFFSET
0,3
LINKS
EXAMPLE
a(2) = 5 because we have [1/2, 1/2, 1/2, 1/2], [1/2, 1/2, 1], [1/2, 1, 1/2], [1, 1/2, 1/2] and [1, 1].
MAPLE
b:= proc(n, r) option remember; `if`(r=0, 1,
add(`if`(r*j<1, 0, b(n, r-1/j)), j=1..n))
end:
a:= n-> b(n$2):
seq(a(n), n=0..10); # Alois P. Heinz, Dec 12 2024
PROG
(Python)
from functools import lru_cache
from fractions import Fraction
def A378842(n):
@lru_cache(maxsize=None)
def f(r): return 1 if r==0 else sum(f(r-Fraction(1, j)) for j in range(int(Fraction(1, r))+(r.numerator!=1), n+1))
return f(n) # Chai Wah Wu, Dec 14 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Ilya Gutkovskiy, Dec 09 2024
EXTENSIONS
More terms from Alois P. Heinz, Dec 12 2024
STATUS
approved