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.

A346502 a(n) = 3n - (sum of digits of 3n in base 3).

Original entry on oeis.org

0, 2, 4, 8, 10, 12, 16, 18, 20, 26, 28, 30, 34, 36, 38, 42, 44, 46, 52, 54, 56, 60, 62, 64, 68, 70, 72, 80, 82, 84, 88, 90, 92, 96, 98, 100, 106, 108, 110, 114, 116, 118, 122, 124, 126, 132, 134, 136, 140, 142, 144, 148, 150, 152, 160, 162, 164, 168, 170, 172
Offset: 0

Views

Author

Bernard Schott, Jul 21 2021

Keywords

Comments

Terms of A344853 without repetition.
All terms are even.
A new largest gap between 2 consecutive terms is obtained between a(3^m-1) and a(3^m), m >= 0 (see formula).
In base 2, A005187(n) = 2n - (sum of digits of 2n in base 2) is also the exponent of the largest power of 2 dividing (2n)!, but here the exponent of the largest power of 3 dividing (3n)! is not a(n) but A004128(n).

Examples

			a(8) = 24 - (sum of digits of 24 in base 3); 24_10 = 220_3 and 2+2+0 = 4, so a(8) = 24-4 = 20.
		

Crossrefs

Cf. A005187 (similar, with base 2).

Programs

  • Mathematica
    a[n_] := 3*n - Plus @@ IntegerDigits[3*n, 3]; Array[a, 100, 0] (* Amiram Eldar, Jul 22 2021 *)
  • PARI
    a(n) = 3*n - sumdigits(n,3); \\ Kevin Ryde, Jul 21 2021
    
  • Python
    from sympy.ntheory.digits import digits
    def a(n): return 3*n - sum(digits(3*n, 3)[1:])
    print([a(n) for n in range(60)]) # Michael S. Branicky, Jul 28 2021

Formula

a(n) = 3*n - A053735(3*n).
a(n) = 2*A004128(n).
a(n) = A344853(3n).
a(3^n) - a(3^n-1) = 2*(n+1).