A004166 Sum of digits of 3^n.
1, 3, 9, 9, 9, 9, 18, 18, 18, 27, 27, 27, 18, 27, 45, 36, 27, 27, 45, 36, 45, 27, 45, 54, 54, 63, 63, 81, 72, 72, 63, 81, 63, 72, 99, 81, 81, 90, 90, 81, 90, 99, 90, 108, 90, 99, 108, 126, 117, 108, 144, 117, 117, 135, 108, 90, 90, 108, 126, 117, 99
Offset: 0
Links
- Michel Marcus, Table of n, a(n) for n = 0..10000 (terms 0..1000 from Vincenzo Librandi)
- Albert Frank, Solutions of International Contest Of Logical Sequences, 2002 - 2003. (The original Contest page without solutions was removed but remains available on web.archive.org.)
Crossrefs
Programs
-
Mathematica
Total[IntegerDigits[#]]&/@(3^Range[0,60]) (* Harvey P. Dale, Mar 03 2013 *) Table[Total[IntegerDigits[3^n]], {n, 0, 60}] (* Vincenzo Librandi, Oct 08 2013 *)
-
PARI
a(n)=sumdigits(3^n); \\ Michel Marcus, Nov 01 2013
-
Python
def a(n): return sum(map(int, str(3**n))) print([a(n) for n in range(61)]) # Michael S. Branicky, Apr 25 2022
Formula
Extensions
Edited by M. F. Hasler, May 18 2017
Comments