login
A330166
Length of the longest run of 0's in the ternary expression of n.
3
1, 0, 0, 1, 0, 0, 1, 0, 0, 2, 1, 1, 1, 0, 0, 1, 0, 0, 2, 1, 1, 1, 0, 0, 1, 0, 0, 3, 2, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 0, 0, 1, 0, 0, 2, 1, 1, 1, 0, 0, 1, 0, 0, 3, 2, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 0, 0, 1, 0, 0, 2, 1, 1, 1, 0, 0, 1, 0, 0, 4, 3, 3, 2, 2, 2, 2, 2, 2, 2
OFFSET
0,10
COMMENTS
All numbers appear in this sequence. The n-th power of 3 (A000244(n)) has n 0's in its ternary expression.
The longest run of zeros possible in this sequence is 2, as the last digit of the ternary expression of the integers cycles between 0, 1, and 2, meaning that at least one of three consecutive numbers has a 0 in its ternary expression.
FORMULA
a(A000244(n)) = a(3^n) = n.
a(n) = 0 iff n is in A032924.
EXAMPLE
For n = 87, the ternary expression of 87 is 10020. The length of the runs of 0's in the ternary expression of 87 are 2 and 1, respectively. The larger of these two values is 2, so a(87) = 2.
n [ternary n] a(n)
0 [ 0] 1
1 [ 1] 0
2 [ 2] 0
3 [ 1 0] 1
4 [ 1 1] 0
5 [ 1 2] 0
6 [ 2 0] 1
7 [ 2 1] 0
8 [ 2 2] 0
9 [ 1 0 0] 2
10 [ 1 0 1] 1
11 [ 1 0 2] 1
12 [ 1 1 0] 1
13 [ 1 1 1] 0
14 [ 1 1 2] 0
15 [ 1 2 0] 1
16 [ 1 2 1] 0
17 [ 1 2 2] 0
18 [ 2 0 0] 2
19 [ 2 0 1] 1
20 [ 2 0 2] 1
MATHEMATICA
Table[Max@FoldList[If[#2==0, #1+1, 0]&, 0, IntegerDigits[n, 3]], {n, 0, 90}]
CROSSREFS
Equals zero iff n is in A032924.
Sequence in context: A375010 A142475 A051556 * A081602 A077267 A134022
KEYWORD
nonn,base
AUTHOR
Joshua Oliver, Dec 04 2019
STATUS
approved