login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A364606
Numbers k such that the average digit of 2^k is an integer.
1
0, 1, 2, 3, 6, 13, 16, 26, 46, 51, 56, 73, 122, 141, 166, 313, 383
OFFSET
1,3
FORMULA
{ k : A001370(k) mod A034887(k) = 0 }.
EXAMPLE
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.
MAPLE
q:= n-> (l-> irem(add(i, i=l), nops(l))=0)(convert(2^n, base, 10)):
select(q, [$0..400])[]; # Alois P. Heinz, Jul 29 2023
MATHEMATICA
Select[Range[0, 2^12], IntegerQ@ Mean@ IntegerDigits[2^#] &] (* Michael De Vlieger, Jul 29 2023 *)
PROG
(PARI) isok(k) = my(d=digits(2^k)); !(vecsum(d) % #d); \\ Michel Marcus, Jul 29 2023
(Python)
from itertools import count, islice
from gmpy2 import mpz, digits
def A364606_gen(startvalue=0): # generator of terms >= startvalue
m = mpz(1)<<max(startvalue, 0)
for k in count(max(startvalue, 0)):
s = digits(m)
if not sum(int(d) for d in s) % len(s):
yield k
m <<= 1
A364606_list = list(islice(A364606_gen(), 10)) # Chai Wah Wu, Jul 31 2023
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Jon E. Schoenfield, Jul 29 2023
STATUS
approved