%I #15 Nov 03 2021 18:21:17
%S 1,79,799,9599,98999,599999,8999998,89998999,899999999,9899999998,
%T 99988999999,779999999999,8999899999999,89999999999999,
%U 799899999999998,9999989999999999,89999999989999999,799999999999999999,9999999999999998999,88999999999999999999,899999999899999999999
%N Smallest n-digit number such that the remainder after dividing by sum of digits is A348730(n).
%C Subsequence of A348799.
%H Chai Wah Wu, <a href="/A348894/b348894.txt">Table of n, a(n) for n = 1..494</a>
%o (Python)
%o from functools import lru_cache
%o from sympy.combinatorics.partitions import IntegerPartition
%o from sympy.utilities.iterables import partitions, multiset_permutations
%o @lru_cache(maxsize=None)
%o def intpartition(n,m): return tuple(''.join(str(d) for d in IntegerPartition(p).partition+[0]*(m-s)) for s, p in partitions(n,k=9,m=m,size=True))
%o def A348894(n):
%o l, c, nmin, k = 9*n, 0, 10**n-1, 10**(n-1)
%o while l > c:
%o for p in intpartition(l,n):
%o for q in multiset_permutations(p):
%o w = int(''.join(q))
%o if w >= k:
%o wr = w % l
%o if wr > c:
%o c = wr
%o nmin = w
%o if wr == c and nmin > w:
%o nmin = w
%o l -= 1
%o return nmin
%Y Cf. A348730, A348799.
%K nonn,base
%O 1,2
%A _Chai Wah Wu_, Nov 02 2021