

A096234


Base 10 "digit addition generators": a(n) = smallest m such that m + (sum of digits of m) = n, or 1 if no such m exists.


1



0, 1, 1, 1, 2, 1, 3, 1, 4, 1, 5, 10, 6, 11, 7, 12, 8, 13, 9, 14, 1, 15, 20, 16, 21, 17, 22, 18, 23, 19, 24, 1, 25, 30, 26, 31, 27, 32, 28, 33, 29, 34, 1, 35, 40, 36, 41, 37, 42, 38, 43, 39, 44, 1, 45, 50, 46, 51, 47, 52, 48, 53, 49, 54, 1, 55, 60, 56, 61, 57, 62
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,5


COMMENTS

The 1 entries in this sequence correspond to A003052, the self numbers.
This sequence has several terms in common with A025804 (as long as we match 1's with 0's), the expansion of 1/((1x^2)(1x^4)(1x^9)). a(25) to a(34) of that sequence match a(10) to a(19) of the present sequence.
There are 102 1's in the first 1000 terms here and 983 1's in the first 10000 terms.  Harvey P. Dale, Feb 22 2016


LINKS

Harvey P. Dale, Table of n, a(n) for n = 0..1000
Max A. Alekseyev, Donovan Johnson and N. J. A. Sloane, On Kaprekar's Junction Numbers, Preprint, 2021.
Eric Weisstein's World of Mathematics, Digit Addition Generator.


EXAMPLE

a(0) = 0 because 0 + 0 = 0
a(1) = 1 because there is no nonnegative integer that added to its digitssum results in 1
a(29) = 19 because 19 + (1 + 9) = 29
a(30) = 24 because 24 + (2 + 4) = 30
a(31) = 1 because there is no integer that added to its digitssum results in 31


MATHEMATICA

msodm[n_]:=Module[{m=n9*IntegerLength[n]}, While[m+Total[ IntegerDigits[ m]] != n&&m<n, m++]; If[m+Total[IntegerDigits[m]]==n, m, 1]]; Array[ msodm, 80, 0] (* Harvey P. Dale, Feb 22 2016, updated Dec 31 2021 *)


PROG

/* PARI: Gen(n, b) returns a list of the generators of n in base b. Written by Max Alekseyev (see Alekseyev et al., 2021).
For example, Gen(101, 10) returns [91, 101].  N. J. A. Sloane, Jan 02 2022 */
{ Gen(u, b=10) = my(d, m, k);
if(u<0  u==1, return([]); );
if(u==0, return([0]); );
d = #digits(u, b)1;
m = u\b^d;
while( sumdigits(m, b) > u  m*b^d,
m;
if(m==0, m=b1; d; );
);
k = u  m*b^d  sumdigits(m, b);
vecsort( concat( apply(x>x+m*b^d, Gen(k, b)),
apply(x>m*b^d1x, Gen((b1)*dk2, b)) ) );
}


CROSSREFS

Cf. A003052, A025804.
Sequence in context: A337377 A308059 A319698 * A340088 A087114 A303753
Adjacent sequences: A096231 A096232 A096233 * A096235 A096236 A096237


KEYWORD

base,sign


AUTHOR

Alonso del Arte, Aug 09 2004


EXTENSIONS

Typo in definition corrected by Harvey P. Dale, Feb 22 2016
Edited. Escape clause value changed from 0 to 1, and a(0) = 0 added.  N. J. A. Sloane, Dec 31 2021


STATUS

approved



