OFFSET
-9,1
COMMENTS
Each occurrence of the consecutive values 2, 1, 0, -1, -2 represents the endpoints, quarter points and middle point of a scaled image of the Cantor middle thirds set. The figure in the examples illustrates the relevance of the values of the terms.
a(n) is the restriction of a function, f, which is defined for all integers as specified in the formula section. For reasons of presentation, the offset is chosen to be -9. (Beyond -9, the next nonzero value of f is f(-45) = -2.) Essentially though, we can consider f to be giving a microscopic view of the middle thirds set around either quarter point.
f:Z -> {-2,-1,0,1,2} is used to generate the closure under multiplication by -3 of the scaled Cantor middle thirds set spanning [-1,3]. So this process also generates similar Cantor sets spanning [-9,3], [-9,27], [-81,27], ... . 0 is clearly a quarter point in all these intervals.
Formally, define c: Z -> P(R) so that c(n) is the empty set if f(n) = 0, otherwise the translated Cantor middle thirds set centered at n+f(n)/9 and scaled by 4/9. Let C_oo be the union of c(m) for all n in Z. C_oo is the closure under multiplication by -3 of the scaled translated Cantor middle thirds set spanning [-1,3].
Note that where f(n) is a lone 0 between 1 and -1, n lies in a gap (empty interval in C_oo) of length 1/6 + 1 + 1/6 = 4/3; whereas a run of k 0's between a -2 and a 2 represents a gap of length 1/2 + k + 1/2 = k+1. The positions of lone 0's are given in A355680.
LINKS
Peter Munn, Table of n, a(n) for n = -9..2187
Eric Weisstein's World of Mathematics, Cantor Set.
FORMULA
a(n) = f(n), where f:Z -> {-2,-1,0,1,2}; f(0) = 1, for integer m, -1 <= i <= 1, writing x = -3*f(-m) - 9i, f(3m+i) = if |x-4| < 3 then x-4 otherwise if |x+4| < 3 then x+4 otherwise 0.
The generation of f can be understood, in the manner of a morphism, using the following table:
f(-m) -> f(3m-1) f(3m) f(3m+1)
-2 -> 0 2 1
-1 -> 0 -1 -2
0 -> 0 0 0
1 -> 2 1 0
2 -> -1 -2 0
For j >= 0, k >= 1, m = (-3)^j, q = 2*3^(j-1):
(1) for -q < i < q, f(m*A355680(k)+i) = 0; -- represents a deleted middle third
a(2n) = A355681(3n).
a(6n) = A355681(n).
a(9n) = a(n).
The following are equivalent: a(n-2) = 2, a(n-1) = 1, a(n+1) = -1, a(n+2) = -2; in which case a(n-5) = a(n-4) = a(n-3) = a(n) = a(n+3) = a(n+4) = a(n+5) = 0 (subject, on an index-by-index basis, to an index not being less than the sequence offset).
EXAMPLE
Illustration of the generation of the scaled Cantor middle thirds set spanning [-1,3], the line titled "Cantor" showing the similar sets of span 4/9 centered at n+a(n)/9 that are mentioned in the comments:
n: -1 0 1 2 3
| | | | |
Ninths: :..:..:..:..:..:..:..:..:..:..:..:..:
"Cantor": |<->| |<->| |<->| |<->|
^ ^ ^ ^
| | | |
>>| >| |< |<<
| | | |
a(n): 2 1 0 -1 -2
.
Notice that n=0 marks the 1/4 point of the scaled middle thirds set spanning [-1/9,1/3], the 3/4 point of the similar set spanning [-1,1/3] and the 1/4 point of the set spanning [-1,3]. This continues at larger scales, 0 being at the 3/4 point of the similar set spanning [-9,3], the 1/4 point of [-9,27] and so on. Likewise at smaller scales, n=0 marks the 3/4 point of the similar set spanning [-1/9,1/27], the 1/4 point of [-1/81,1/27] etc.
PROG
(PARI) a(n) = {if (n==0, 1,
my(x); x = -3*a(-n\/3) - 9*((n+1)%3-1);
if(abs(x-4)<3, x-4, if(abs(x+4)<3, x+4, 0)))}
CROSSREFS
KEYWORD
sign,easy
AUTHOR
Peter Munn, Jul 14 2022
STATUS
approved