%I #17 Jul 31 2023 10:43:14
%S 0,1,2,3,6,13,16,26,46,51,56,73,122,141,166,313,383
%N Numbers k such that the average digit of 2^k is an integer.
%F { k : A001370(k) mod A034887(k) = 0 }.
%e 2^26 = 67108864 is an 8-digit number; its average digit is (6+7+1+0+8+8+6+4)/8 = 40/8 = 5, an integer, so 26 is a term.
%p q:= n-> (l-> irem(add(i, i=l), nops(l))=0)(convert(2^n, base, 10)):
%p select(q, [$0..400])[]; # _Alois P. Heinz_, Jul 29 2023
%t Select[Range[0, 2^12], IntegerQ@ Mean@ IntegerDigits[2^#] &] (* _Michael De Vlieger_, Jul 29 2023 *)
%o (PARI) isok(k) = my(d=digits(2^k)); !(vecsum(d) % #d); \\ _Michel Marcus_, Jul 29 2023
%o (Python)
%o from itertools import count, islice
%o from gmpy2 import mpz, digits
%o def A364606_gen(startvalue=0): # generator of terms >= startvalue
%o m = mpz(1)<<max(startvalue,0)
%o for k in count(max(startvalue,0)):
%o s = digits(m)
%o if not sum(int(d) for d in s) % len(s):
%o yield k
%o m <<= 1
%o A364606_list = list(islice(A364606_gen(),10)) # _Chai Wah Wu_, Jul 31 2023
%Y Cf. A000079, A001370, A034887, A061383.
%K nonn,base
%O 1,3
%A _Jon E. Schoenfield_, Jul 29 2023