login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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

%I #31 Sep 04 2022 14:41:32

%S 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,

%T 22,18,23,19,24,-1,25,30,26,31,27,32,28,33,29,34,-1,35,40,36,41,37,42,

%U 38,43,39,44,-1,45,50,46,51,47,52,48,53,49,54,-1,55,60,56,61,57,62

%N 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.

%C The -1 entries in this sequence correspond to A003052, the self numbers.

%C This sequence has several terms in common with A025804 (as long as we match -1's with 0's), the expansion of 1/((1-x^2)(1-x^4)(1-x^9)). a(25) to a(34) of that sequence match a(10) to a(19) of the present sequence.

%C 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

%H Harvey P. Dale, <a href="/A096234/b096234.txt">Table of n, a(n) for n = 0..1000</a>

%H Max A. Alekseyev and N. J. A. Sloane, <a href="https://arxiv.org/abs/2112.14365">On Kaprekar's Junction Numbers</a>, arXiv:2112.14365, 2021; Journal of Combinatorics and Number Theory, 2022 (to appear).

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/DigitadditionGenerator.html">Digit Addition Generator</a>.

%e a(0) = 0 because 0 + 0 = 0

%e a(1) = -1 because there is no nonnegative integer that added to its digits-sum results in 1

%e a(29) = 19 because 19 + (1 + 9) = 29

%e a(30) = 24 because 24 + (2 + 4) = 30

%e a(31) = -1 because there is no integer that added to its digits-sum results in 31

%t msodm[n_]:=Module[{m=n-9*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 *)

%o /* PARI: Gen(n,b) returns a list of the generators of n in base b. Written by _Max Alekseyev_ (see Alekseyev et al., 2021).

%o For example, Gen(101,10) returns [91, 101]. - _N. J. A. Sloane_, Jan 02 2022 */

%o { Gen(u,b=10) = my(d,m,k);

%o if(u<0 || u==1, return([]); );

%o if(u==0, return([0]); );

%o d = #digits(u,b)-1;

%o m = u\b^d;

%o while( sumdigits(m,b) > u - m*b^d,

%o m--;

%o if(m==0, m=b-1; d--; );

%o );

%o k = u - m*b^d - sumdigits(m,b);

%o vecsort( concat( apply(x->x+m*b^d,Gen(k,b)),

%o apply(x->m*b^d-1-x,Gen((b-1)*d-k-2,b)) ) );

%o }

%Y Cf. A003052, A025804.

%K base,sign

%O 0,5

%A _Alonso del Arte_, Aug 09 2004

%E Typo in definition corrected by _Harvey P. Dale_, Feb 22 2016

%E Edited. Escape clause value changed from 0 to -1, and a(0) = 0 added. - _N. J. A. Sloane_, Dec 31 2021

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 04:42 EDT 2024. Contains 371964 sequences. (Running on oeis4.)