login
A307744
A fractal function, related to ruler functions and the Cantor set. a(1) = 0; for m >= 0, a(3m) = 1; for m >= 1, a(3m-1) = a(m-1) + sign(a(m-1)), a(3m+1) = a(m+1) + sign(a(m+1)).
6
1, 0, 2, 1, 3, 0, 1, 2, 3, 1, 4, 2, 1, 0, 4, 1, 2, 0, 1, 3, 2, 1, 4, 3, 1, 2, 4, 1, 5, 2, 1, 3, 5, 1, 2, 3, 1, 0, 2, 1, 5, 0, 1, 2, 5, 1, 3, 2, 1, 0, 3, 1, 2, 0, 1, 4, 2, 1, 3, 4, 1, 2, 3, 1, 5, 2, 1, 4, 5, 1, 2, 4, 1, 3, 2, 1, 5, 3, 1, 2, 5, 1, 6, 2, 1
OFFSET
0,3
COMMENTS
The sequence extends to negative n by defining a(n) = a(-n).
For k >= 1 numbers 1..k occur with the same periodic and mirror symmetries as in ruler function A051064, in which k occurs 3 times more frequently than k+1. Here k occurs 3/2 times more frequently than k+1, precisely 2^(k-1) times in every 3^k terms. 0 has asymptotic density 0. Taking a trisection shows some scale symmetry, again comparable to ruler functions, as illustrated in the example section.
The links include a pin plot of a(0..162) aligned above an inverted plot of A051064 (the emphatic marking of 0's is significant). Between each n_k where A051064(n_k) = k >= 2 and the nearest n_k' where A051064(n_k') > k (or n_k' = 0 if nearer), there are 2^(k-2) indices where k occurs in this sequence, forming a 2^(k-2)-tuple. The 2^(k-2)-tuples have identical patterns and each has symmetry about an n_(k-1) where A051064(n_(k-1)) = k-1.
For a given k, the tuples described above are periodic with two per fundamental period, and the closest pairs of these tuples jointly form the pattern of one of the equivalent tuples for k+1. These patterns relate to the nonperiodic pattern for 0's and to the Cantor set as follows.
Let S_k be the sequence of positive indices at which k occurs, with 3^(k-2) subtracted when k >= 2. Given its ruler-type symmetries, S_k k >= 2 is determined by its first 2^(k-2) terms, which are the same as the first 2^(k-2) terms of S_i for i > k. The limiting sequence as k goes to infinity is S_0, which is A191108. {A191108(i)/(2*3^k) | 1 <= i <= 2^k} is the set of center points of the intervals deleted at step k+1 when generating the Cantor ternary set. This leads to the following scaling property.
Define c: Z -> P(R) so that c(n) is the scaled and translated Cantor ternary set spanning [n-1, n+1], and let C_k be the union of c(n) for all integer n with a(n) = k. Clearly C_1 consists of a scaled Cantor set repeated with period 3. (The set's two nonempty thirds occur at alternating intervals of 4/3 and 5/3.) For k >= 1, C_k is C_1 scaled by 3^(k-1), consisting therefore of a scaled Cantor set repeated with period 3^k. C_0 is special: C_0 = (C_0)*3 = (C_0)/3 = -C_0. Specifically, (C_0)/2 is the closure of the Cantor ternary set under multiplication by 3 and by -1.
Take a Sierpinski arrowhead curve formed of unit edges numbered consecutively from 0 at its axis of symmetry and aligned with an infinite Sierpinski gasket so that each edge is contained in the boundary of either the plane sector occupied by the gasket or a triangular region of the gasket's complement. If a(n) = 0, the n-th edge is contained in the sector boundary, otherwise the relevant triangular region seems to have side 2^(a(n)-1). See A307672 for a fuller description. The conjectured formulas below (that use A094373) derive from summing areas of regions within the gasket. - Corrected by Peter Munn, Aug 09 2019
From Charlie Neder, Jul 05 2019: (Start)
For each n, define the "2-balanced ternary expansion" E(n) as follows:
- E(n) begins with 0 or 1, according to the parity of n.
- The following digits are +, 0, or - as in standard balanced ternary, except + and - correspond to +2 and -2, respectively.
For example, we have E(4) = 0+-, E(7) = 10-, and E(13) = 1+-.
Then a(n) is the distance from the end of the rightmost 0, counting the last digit as 1, or 0 if 0 never appears. (End)
FORMULA
Alternative definition: (Start)
a(m*3^k - 3^(k-1) + A191108(i)) = k for k >= 1, 1 <= i <= 2^(k-1), all integer m.
a(A191108(i)) = a(-A191108(i)) = 0 for i >= 1.
(End)
if a(n) = k >= 1, a(3^k+n) = a(3^k-n) = k.
a(n) = a(12*3^k + n) for k >= 0, 0 <= n <= 3^k.
if a(n) = a(n') and a(n+1) = a(n'+1) then a(n*3^k + i) = a(n'*3^k + i) for k >= 0, 0 <= i <= 3^k.
a((m-1)*3^k + 1) = a((m+1)*3^k - 1) for k >= 1, all integer m.
Upper bound relations: (Start)
for k >= 2, let m_k = A034472(k-2) = 3^(k-2)+1.
a(n) < k, for -m_k < n < m_k.
a(-m_k) = a(m_k) = k.
(End)
for k>=0, a( 3^k-1) = k+1, a( 3^k+1) = k+2.
for k>=0, a(2*3^k-1) = 0, a(2*3^k+1) = k+1.
for k>=0, a(4*3^k-1) = k+1, a(4*3^k+1) = 0.
for k>=0, a(5*3^k-1) = k+3, a(5*3^k+1) = k+1.
for k>=0, a(7*3^k-1) = k+1, a(7*3^k+1) = k+3.
for k>=0, a(8*3^k-1) = k+2, a(8*3^k+1) = k+1.
A051064(i) = min{a(n) : |n-i| = 1, a(n) > 0}.
A055246(i+1) = min{n : n > A055246(i) + 1, a(n) = a(A055246(i) + 1)}.
Sum_{n=-3^k..3^k-1} A094373(a(n)) = 3 * 4^k (conjectured).
Sum_{n=-3m..3m-1} A094373(a(n)) = 4 * Sum_{n=-m..m-1} A094373(a(n)) (conjectured).
From Charlie Neder, Jul 05 2019: (Start)
Let P(n) be the power of 3 (greater than 1) closest to n and T(n) be the distance from the end - counting the last digit as 1 - of the rightmost 0 in the balanced ternary expansion of n.
If n is even, a(n) = T(n/2).
If n is odd, a(n) = T((P(n)-n)/2), or 0 if this number exceeds log_3(P(n)). (End)
EXAMPLE
As 4 is congruent to 1 modulo 3, a(4) = a(3*1 + 1) = a(1+1) + sign (a(1+1)) = a(2) + sign(a(2)).
As 2 is congruent to -1 modulo 3, a(2) = a(3*1 - 1) = a(1-1) + sign (a(1-1)) = a(0) + sign(a(0)).
As 0 is congruent to 0 modulo 3, a(0) = 1. So a(2) = a(0) + sign(a(0)) = 1 + 1 = 2. So a(4) = a(2) + sign(a(2)) = 2 + 1 = 3.
For any m, the sequence from 9m - 9 to 9m + 9 can be represented by the table below. x, y and z represent distinct integers unless m = 0, in which case x = z = 0. Distinct values are shown in their own column to highlight patterns.
n a(n)
9m-9 1
9m-8 y - starts pattern (9m-8, 9m-4, 9m+4, 9m+8)
9m-7 2
9m-6 1
9m-5 x
9m-4 y
9m-3 1
9m-2 2
9m-1 x - ends pattern (9m-17, 9m-13, 9m-5, 9m-1)
9m 1
9m+1 z - starts pattern (9m+1, 9m+5, 9m+13, 9m+17)
9m+2 2
9m+3 1
9m+4 y
9m+5 z
9m+6 1
9m+7 2
9m+8 y - ends pattern (9m-8, 9m-4, 9m+4, 9m+8)
9m+9 1
For all m, one of x, y, z represents 3 in this table. Note the identical patterns indicated for "x", "y", "z" quadruples, and how the "x" quadruple ends 2 before the "z" quadruple starts, with the "y" quadruple overlapping both. For k >= 1, there are equivalent 2^k-tuples that overlap similarly, notably (3m-2, 3m+2) for all m.
Larger 2^k-tuples look more fractal, more obviously related to the Cantor set. See the pin plot of a(0..162) aligned above an inverted plot of ruler function A051064 in the links. 0's are emphasized with a fainter line running off the top of the plot, partly because 0 is used here as a conventional value and occurs with some properties (such as zero asymptotic density) that could be considered appropriate to the largest rather than smallest value in the sequence.
The table below illustrates the symmetries of scale of this sequence and ruler function A051064. Note the column for this sequence is indexed by k+1, 3k+1, 9k+1, whereas that for A051064 is indexed by k, 3k, 9k.
a(n+1) A051064(n)
n=k, k=16..27 0,1,3,2,1,4,3,1,2,4,1,5 1,1,3,1,1,2,1,1,2,1,1,4
n=3k,k=16..27 0,2,4,3,2,5,4,2,3,5,2,6 2,2,4,2,2,3,2,2,3,2,2,5
n=9k,k=16..27 0,3,5,4,3,6,5,3,4,6,3,7 3,3,5,3,3,4,3,3,4,3,3,6
PROG
(PARI) a(n) = if (n==1, 0, my(m=n%3); if (m==0, 1, my(kk = (if (m==1, a(n\3+1), a((n-2)\3)))); kk + sign(kk)));
for (n=0, 100, print1(a(n), ", ")) \\ Michel Marcus, Jul 06 2019
CROSSREFS
Sequences with similar definitions: A309054, A335933.
A055246, A191108, A306556 relate to the Cantor set.
Sequence in context: A140699 A140256 A126206 * A119709 A328167 A253556
KEYWORD
nonn,look
AUTHOR
Peter Munn, Apr 26 2019
STATUS
approved