# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/
Search: id:a004166
Showing 1-1 of 1
%I A004166 #52 Oct 24 2023 20:36:13
%S A004166 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,
%T A004166 63,63,81,72,72,63,81,63,72,99,81,81,90,90,81,90,99,90,108,90,99,108,
%U A004166 126,117,108,144,117,117,135,108,90,90,108,126,117,99
%N A004166 Sum of digits of 3^n.
%C A004166 All terms a(n), n > 1, are divisible by 9. - _M. F. Hasler_, Sep 27 2017
%H A004166 Michel Marcus, Table of n, a(n) for n = 0..10000 (terms 0..1000 from Vincenzo Librandi)
%H A004166 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.)
%F A004166 a(n) = A007953(A000244(n)). - _Michel Marcus_, Nov 01 2013
%t A004166 Total[IntegerDigits[#]]&/@(3^Range[0,60]) (* _Harvey P. Dale_, Mar 03 2013 *)
%t A004166 Table[Total[IntegerDigits[3^n]], {n, 0, 60}] (* _Vincenzo Librandi_, Oct 08 2013 *)
%o A004166 (PARI) a(n)=sumdigits(3^n); \\ _Michel Marcus_, Nov 01 2013
%o A004166 (Python)
%o A004166 def a(n): return sum(map(int, str(3**n)))
%o A004166 print([a(n) for n in range(61)]) # _Michael S. Branicky_, Apr 25 2022
%Y A004166 Cf. A067500, A118872, A175435.
%Y A004166 Cf. sum of digits of k^n: A001370 (k=2), this sequence (k=3), A065713 (k=4), A066001 (k=5), A066002 (k=6), A066003 (k=7), A066004 (k=8), A065999 (k=9), A066005 (k=11), A066006 (k=12), A175527 (k=13).
%K A004166 nonn,base
%O A004166 0,2
%A A004166 _N. J. A. Sloane_
%E A004166 Edited by _M. F. Hasler_, May 18 2017
# Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE