login
A346502
a(n) = 3n - (sum of digits of 3n in base 3).
1
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,2
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).
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).
EXAMPLE
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.
MATHEMATICA
a[n_] := 3*n - Plus @@ IntegerDigits[3*n, 3]; Array[a, 100, 0] (* Amiram Eldar, Jul 22 2021 *)
PROG
(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
CROSSREFS
Cf. A005187 (similar, with base 2).
Sequence in context: A195066 A036990 A097498 * A321580 A224694 A140900
KEYWORD
nonn,base
AUTHOR
Bernard Schott, Jul 21 2021
STATUS
approved