login
A292995
Sum of digits of 3^n (A004166) divided by 9.
1
0, 0, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 2, 3, 5, 4, 3, 3, 5, 4, 5, 3, 5, 6, 6, 7, 7, 9, 8, 8, 7, 9, 7, 8, 11, 9, 9, 10, 10, 9, 10, 11, 10, 12, 10, 11, 12, 14, 13, 12, 16, 13, 13, 15, 12, 10, 10, 12, 14, 13, 11, 15, 17, 17, 16, 15, 13, 18, 17, 17, 16, 20, 18, 17, 19, 20, 17, 18
OFFSET
0,7
COMMENTS
All terms A004166(n), n >= 2, are multiples of 9.
For the first two terms, the (zero) integer part of the fractional values (1/9 and 3/9) is taken: This seems to be the most natural extension of the maybe more natural variant of this sequence which would start only at offset n = 2.
Divisibility of A004166(n) by any prime different from 3 is equivalent to divisibility of a(n) by that prime. For example, indices of terms of A004166 divisible by 7, listed in A292931, are also exactly the indices > 1 of terms a(n) divisible by 7.
MAPLE
0, 0, seq(convert(convert(3^n, base, 10), `+`)/9, n=2..100); # Robert Israel, Sep 28 2017
MATHEMATICA
Rest[Table[Sum[DigitCount[(3^n)][[i]] i, {i, 9}] / 9, {n, 100}]] (* Vincenzo Librandi, Sep 28 2017 *)
PROG
(PARI) a(n)=sumdigits(3^n)\9
(Magma) [n lt 2 select 0 else &+Intseq(3^n)/9: n in [0..100]]; // Vincenzo Librandi, Sep 28 2017
(Python)
from __future__ import division
def A292995(n):
return sum(int(d) for d in str(3**n))//9 # Chai Wah Wu, Sep 28 2017
CROSSREFS
Sequence in context: A080967 A078570 A295284 * A037179 A127971 A319290
KEYWORD
nonn,base
AUTHOR
M. F. Hasler, Sep 27 2017
STATUS
approved