cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-1 of 1 results.

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

Original entry on oeis.org

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, 11, 9, 9, 10, 10, 9, 10, 11, 10, 12, 10, 11, 12, 14, 13, 12, 16, 13, 13, 15, 12, 10, 10, 12, 14, 13, 11, 15, 17, 17, 16, 15, 13, 18, 17, 17, 16, 20, 18, 17, 19, 20, 17, 18
Offset: 0

Views

Author

M. F. Hasler, Sep 27 2017

Keywords

Comments

All terms A004166(n), n >= 2, are multiples of 9.
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.
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.

Crossrefs

Programs

  • Magma
    [n lt 2 select 0 else &+Intseq(3^n)/9: n in [0..100]]; // Vincenzo Librandi, Sep 28 2017
    
  • Maple
    0,0,seq(convert(convert(3^n,base,10),`+`)/9, n=2..100); # Robert Israel, Sep 28 2017
  • Mathematica
    Rest[Table[Sum[DigitCount[(3^n)][[i]] i, {i, 9}] / 9, {n, 100}]] (* Vincenzo Librandi, Sep 28 2017 *)
  • PARI
    a(n)=sumdigits(3^n)\9
    
  • Python
    from _future_ import division
    def A292995(n):
        return sum(int(d) for d in str(3**n))//9 # Chai Wah Wu, Sep 28 2017
Showing 1-1 of 1 results.