login
Sum of digits of 3^n (A004166) divided by 9.
1

%I #20 Sep 08 2022 08:46:19

%S 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,

%T 11,9,9,10,10,9,10,11,10,12,10,11,12,14,13,12,16,13,13,15,12,10,10,12,

%U 14,13,11,15,17,17,16,15,13,18,17,17,16,20,18,17,19,20,17,18

%N Sum of digits of 3^n (A004166) divided by 9.

%C All terms A004166(n), n >= 2, are multiples of 9.

%C 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.

%C 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.

%H Chai Wah Wu, <a href="/A292995/b292995.txt">Table of n, a(n) for n = 0..10000</a>

%p 0,0,seq(convert(convert(3^n,base,10),`+`)/9, n=2..100); # _Robert Israel_, Sep 28 2017

%t Rest[Table[Sum[DigitCount[(3^n)][[i]] i, {i, 9}] / 9, {n, 100}]] (* _Vincenzo Librandi_, Sep 28 2017 *)

%o (PARI) a(n)=sumdigits(3^n)\9

%o (Magma) [n lt 2 select 0 else &+Intseq(3^n)/9: n in [0..100]]; // _Vincenzo Librandi_, Sep 28 2017

%o (Python)

%o from __future__ import division

%o def A292995(n):

%o return sum(int(d) for d in str(3**n))//9 # _Chai Wah Wu_, Sep 28 2017

%Y Cf. A004166, A292931.

%K nonn,base

%O 0,7

%A _M. F. Hasler_, Sep 27 2017