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”).

Sum of decimal digits of (3^n - 1)/2 (A003462).
2

%I #35 Nov 30 2022 00:02:01

%S 0,1,4,4,4,4,13,13,13,22,22,31,22,31,31,31,22,31,31,31,31,31,49,49,40,

%T 40,49,67,58,58,58,76,58,76,85,85,85,85,94,85,85,94,103,103,85,94,103,

%U 112,103,112,130,130,94,121,112,112,121,103,103,121,112,121,121,139,121,148,121,157,157,157,157,175,157,157

%N Sum of decimal digits of (3^n - 1)/2 (A003462).

%C a(n) == 4 (mod 9) for n >= 2. - _Robert Israel_, Nov 21 2022

%H Michel Marcus, <a href="/A358509/b358509.txt">Table of n, a(n) for n = 0..5000</a>

%F a(n) = A007953(A003462(n)).

%e For n=5, (3^n - 1)/2 = 121 so that a(5) = 1+2+1 = 4.

%p seq(convert(convert((3^n-1)/2,base,10),`+`),n=0..100); # _Robert Israel_, Nov 21 2022

%t a[n_] := Total[IntegerDigits[(3^n - 1)/2]]; Array[a, 100, 0] (* _Amiram Eldar_, Nov 20 2022 *)

%o (PARI) a(n) = sumdigits((3^n - 1)/2); \\ _Michel Marcus_, Nov 20 2022

%o (Python)

%o def A358509(n): return sum(map(int,str((3**n-1)>>1))) # _Chai Wah Wu_, Nov 21 2022

%Y Cf. A003462, A007953, A017209.

%Y Cf. A004166 (of 3^n).

%K nonn,base,easy

%O 0,3

%A _Paul Curtz_, Nov 20 2022