A049803 a(n) = n mod 3 + n mod 9 + ... + n mod 3^k, where 3^k <= n < 3^(k+1).
0, 0, 0, 1, 2, 0, 1, 2, 0, 2, 4, 3, 5, 7, 6, 8, 10, 0, 2, 4, 3, 5, 7, 6, 8, 10, 0, 3, 6, 6, 9, 12, 12, 15, 18, 9, 12, 15, 15, 18, 21, 21, 24, 27, 18, 21, 24, 24, 27, 30, 30, 33, 36, 0, 3, 6, 6, 9, 12, 12, 15, 18, 9, 12, 15, 15, 18, 21, 21, 24, 27, 18
Offset: 1
Keywords
Links
- Metin Sariyar, Table of n, a(n) for n = 1..32000
- B. Dearden, J. Iiams, and J. Metzger, A Function Related to the Rumor Sequence Conjecture, J. Int. Seq. 14 (2011), #11.2.3, Example 7.
Programs
-
Maple
a:= n-> add(irem(n, 3^j), j=1..ilog[3](n)): seq(a(n), n=1..105); # Alois P. Heinz, Dec 13 2019
-
Mathematica
Table[n * Floor@Log[3, n] - Sum[Floor[n*3^-k]*3^k, {k, Log[3, n]}], {n, 100}] (* after Federico Provvedi in A049802*) (* Metin Sariyar, Dec 12 2019 *)
-
PARI
a(n) = sum(k=1, logint(n, 3), n % 3^k); \\ Michel Marcus, Dec 12 2019
Formula
From Petros Hadjicostas, Dec 11 2019: (Start)
Conjecture: a(3*n+r) = 3*a(n) + r*A081604(n) = 3*a(n) + r*(floor(log_3(n)) + 1) for n >= 1 and r = 0, 1, 2.
If the conjecture above is true, the g.f. A(x) satisfies A(x) = 3*(1+x+x^2)*A(x^3) + x*(2*x+1)/(1-x^3) * Sum_{k >= 1} x^(3^k). (End)
Comments