This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A307744 #48 Feb 16 2025 08:33:55 %S A307744 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, %T A307744 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, %U A307744 5,1,2,4,1,3,2,1,5,3,1,2,5,1,6,2,1 %N 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)). %C A307744 The sequence extends to negative n by defining a(n) = a(-n). %C A307744 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. %C A307744 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. %C A307744 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. %C A307744 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. %C A307744 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. %C A307744 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 %C A307744 From _Charlie Neder_, Jul 05 2019: (Start) %C A307744 For each n, define the "2-balanced ternary expansion" E(n) as follows: %C A307744 - E(n) begins with 0 or 1, according to the parity of n. %C A307744 - The following digits are +, 0, or - as in standard balanced ternary, except + and - correspond to +2 and -2, respectively. %C A307744 For example, we have E(4) = 0+-, E(7) = 10-, and E(13) = 1+-. %C A307744 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) %H A307744 Peter Munn, <a href="/A307744/b307744.txt">Table of n, a(n) for n = 0..4374</a> %H A307744 Peter Munn, <a href="/A309054/a309054.png">Arrowhead curve aligned with Sierpiński gasket</a>. %H A307744 Peter Munn, <a href="/A307744/a307744_1.png">Pin plot aligned above inverted plot of A051064</a>. %H A307744 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/CantorSet.html">Cantor Set</a> %H A307744 Wikipedia, <a href="https://en.wikipedia.org/wiki/Sierpi%C5%84ski_arrowhead_curve">Sierpiński arrowhead curve</a> %F A307744 Alternative definition: (Start) %F A307744 a(m*3^k - 3^(k-1) + A191108(i)) = k for k >= 1, 1 <= i <= 2^(k-1), all integer m. %F A307744 a(A191108(i)) = a(-A191108(i)) = 0 for i >= 1. %F A307744 (End) %F A307744 if a(n) = k >= 1, a(3^k+n) = a(3^k-n) = k. %F A307744 a(n) = a(12*3^k + n) for k >= 0, 0 <= n <= 3^k. %F A307744 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. %F A307744 a((m-1)*3^k + 1) = a((m+1)*3^k - 1) for k >= 1, all integer m. %F A307744 Upper bound relations: (Start) %F A307744 for k >= 2, let m_k = A034472(k-2) = 3^(k-2)+1. %F A307744 a(n) < k, for -m_k < n < m_k. %F A307744 a(-m_k) = a(m_k) = k. %F A307744 (End) %F A307744 for k>=0, a( 3^k-1) = k+1, a( 3^k+1) = k+2. %F A307744 for k>=0, a(2*3^k-1) = 0, a(2*3^k+1) = k+1. %F A307744 for k>=0, a(4*3^k-1) = k+1, a(4*3^k+1) = 0. %F A307744 for k>=0, a(5*3^k-1) = k+3, a(5*3^k+1) = k+1. %F A307744 for k>=0, a(7*3^k-1) = k+1, a(7*3^k+1) = k+3. %F A307744 for k>=0, a(8*3^k-1) = k+2, a(8*3^k+1) = k+1. %F A307744 A051064(i) = min{a(n) : |n-i| = 1, a(n) > 0}. %F A307744 A055246(i+1) = min{n : n > A055246(i) + 1, a(n) = a(A055246(i) + 1)}. %F A307744 Sum_{n=-3^k..3^k-1} A094373(a(n)) = 3 * 4^k (conjectured). %F A307744 Sum_{n=-3m..3m-1} A094373(a(n)) = 4 * Sum_{n=-m..m-1} A094373(a(n)) (conjectured). %F A307744 From _Charlie Neder_, Jul 05 2019: (Start) %F A307744 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. %F A307744 If n is even, a(n) = T(n/2). %F A307744 If n is odd, a(n) = T((P(n)-n)/2), or 0 if this number exceeds log_3(P(n)). (End) %e A307744 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)). %e A307744 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)). %e A307744 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. %e A307744 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. %e A307744 n a(n) %e A307744 9m-9 1 %e A307744 9m-8 y - starts pattern (9m-8, 9m-4, 9m+4, 9m+8) %e A307744 9m-7 2 %e A307744 9m-6 1 %e A307744 9m-5 x %e A307744 9m-4 y %e A307744 9m-3 1 %e A307744 9m-2 2 %e A307744 9m-1 x - ends pattern (9m-17, 9m-13, 9m-5, 9m-1) %e A307744 9m 1 %e A307744 9m+1 z - starts pattern (9m+1, 9m+5, 9m+13, 9m+17) %e A307744 9m+2 2 %e A307744 9m+3 1 %e A307744 9m+4 y %e A307744 9m+5 z %e A307744 9m+6 1 %e A307744 9m+7 2 %e A307744 9m+8 y - ends pattern (9m-8, 9m-4, 9m+4, 9m+8) %e A307744 9m+9 1 %e A307744 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. %e A307744 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. %e A307744 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. %e A307744 a(n+1) A051064(n) %e A307744 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 %e A307744 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 %e A307744 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 %o A307744 (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))); %o A307744 for (n=0, 100, print1(a(n), ", ")) \\ _Michel Marcus_, Jul 06 2019 %Y A307744 Sequences with similar definitions: A309054, A335933. %Y A307744 A055246, A191108, A306556 relate to the Cantor set. %Y A307744 Cf. A034472, A051064, A094373, A307672. %K A307744 nonn,look %O A307744 0,3 %A A307744 _Peter Munn_, Apr 26 2019