login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

a(n) is the smallest d such that the sum of digits of 2^d + n is equal to d, or -1 if no such d exists.
3

%I #29 Nov 12 2023 06:30:58

%S 5,9,103,10,3,7,4,2,1,5,9,12,10,3,7,4,2,18,5,9,12,10,3,7,4,20,18,70,9,

%T 12,10

%N a(n) is the smallest d such that the sum of digits of 2^d + n is equal to d, or -1 if no such d exists.

%C The first open case is 31. If a(31) is not -1, then it is at least 20000.

%C If a(i) = m > 0 then A328882 takes the value i for the first time at term 2^m+i. For example, the first appearance of 2 in A328882 is at term 2^103 + 2.

%C From _Yusuf Gurtas_, Dec 27 2019: (Start)

%C a(n)=1 if and only if n+2 is a positive integer whose sum of digits is 1. Since the only such numbers are 10^k the only solutions to a(n)=1 are n=10^k-2 for k=1,2,... In other words, a(n)=1 if and only if n = 8, 98, 998, 9998, 99998, 999998, .... In particular, a(n)=1 has infinitely many solutions.

%C Using the same idea, a(n)=2 can be solved. a(n)=2 if and only if n + 2^2 = n + 4 is a positive integer whose sum of digits is 2. Since the only such numbers are 2*10^k or 10^j*(10^k+1) for j=0,1,2,..., k=1,2,3,..., the only solutions to a(n)=2 are n = 10^j*(10^k+1) - 4 for j=0,1,2,..., k=1,2,3,.... The first 30 solutions are n = 7, 16, 97, 106, 196, 997, 1006, 1096, 1996, 9997, 10006, 10096, 10996, 19996, 99997, 100006, 100096, 100996, 109996, 199996, 999997, 1000006, 1000096, 1000996, 1009996, 1099996, 1999996, 9999997, 10000006, 10000096.

%C (End)

%e n=1: 2^9 + 1 = 513 has digit sum 9, so a(1) = 9.

%e n=2: 2^103 + 2 has digit sum 103, and no smaller number has this property, so a(2) = 103.

%t Array[Block[{d = 1}, While[Total@ IntegerDigits[2^d + #] != d, d++]; d] &, 31, 0] (* _Michael De Vlieger_, Dec 29 2019 *)

%o (PARI) a(n) = my(d=1); while (sumdigits(2^d+n) != d, d++); d; \\ _Michel Marcus_, Nov 12 2023

%Y Cf. A328882, A329492.

%K nonn,base,more

%O 0,1

%A _N. J. A. Sloane_, Nov 16 2019