OFFSET
1,5
COMMENTS
MATHEMATICA
(* EulerInvTransform is defined in A022562. *)
EulerInvTransform[LinearRecurrence[{1, 1, 1}, {0, 1, 1}, 40]]
PROG
(Python) # After the Maple program of Alois P. Heinz in A349904.
from functools import cache
from math import comb
def euler_inv_trans(a: callable, len: int):
@cache
def h(n: int, k: int):
if n == 0: return 1
if k < 1: return 0
bk = b(k)
R = range(int(bk == 0), 1 + n // k)
return sum(comb(bk + j - 1, j) * h(n - k * j, k - 1) for j in R)
@cache
def b(n: int): return a(n - 1) - h(n, n - 1)
return [b(n) for n in range(1, len)]
@cache
def tribonacci(n: int):
return sum(tribonacci(n - j - 1) for j in range(3)) if n >= 3 else min(n, 1)
print(euler_inv_trans(tribonacci, 40))
CROSSREFS
KEYWORD
nonn
AUTHOR
Peter Luschny, Dec 07 2021
STATUS
approved