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.
LINKS
Chai Wah Wu, Table of n, a(n) for n = 0..10000
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
KEYWORD
nonn,base
AUTHOR
M. F. Hasler, Sep 27 2017
STATUS
approved