A digit addition generator of an integer n
is any integer x
that satisfy the equation x + s(x) = n
, with s(x)
being the sum of the digits of x
. (We will work under base 10 for convenience.)
For example, a digit addition generator for 29
would be 19
, because 19 + (1 + 9) = 29
. Some numbers have more than one generator. An example might be 216
, which has generators of 198
and 207
.
Your objective is to generate the sequence a_n
where a_i
is the lowest digit addition generator of every non-negative integer i
, and anything other than a non-negative integer if there is none for i
.
The non-negative terms in your result should match the sequence A096234. You may find this paper related to the challenge.
Fewest bytes win; standard rules apply.
0
is0
? \$\endgroup\$0 + (0)
is indeed0
\$\endgroup\$x<=n
and not justx<n
. Perhaps you could addn=0
to the challenge as a test case, along with a few others, as a few of us did get tripped up by it. \$\endgroup\$