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

A358509
Sum of decimal digits of (3^n - 1)/2 (A003462).
2
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, 40, 49, 67, 58, 58, 58, 76, 58, 76, 85, 85, 85, 85, 94, 85, 85, 94, 103, 103, 85, 94, 103, 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
OFFSET
0,3
COMMENTS
a(n) == 4 (mod 9) for n >= 2. - Robert Israel, Nov 21 2022
LINKS
FORMULA
a(n) = A007953(A003462(n)).
EXAMPLE
For n=5, (3^n - 1)/2 = 121 so that a(5) = 1+2+1 = 4.
MAPLE
seq(convert(convert((3^n-1)/2, base, 10), `+`), n=0..100); # Robert Israel, Nov 21 2022
MATHEMATICA
a[n_] := Total[IntegerDigits[(3^n - 1)/2]]; Array[a, 100, 0] (* Amiram Eldar, Nov 20 2022 *)
PROG
(PARI) a(n) = sumdigits((3^n - 1)/2); \\ Michel Marcus, Nov 20 2022
(Python)
def A358509(n): return sum(map(int, str((3**n-1)>>1))) # Chai Wah Wu, Nov 21 2022
CROSSREFS
Cf. A004166 (of 3^n).
Sequence in context: A377748 A294246 A107680 * A285052 A369719 A369757
KEYWORD
nonn,base,easy
AUTHOR
Paul Curtz, Nov 20 2022
STATUS
approved