cp's OEIS Frontend

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.

Showing 1-8 of 8 results.

A001196 Double-bitters: only even length runs in binary expansion.

Original entry on oeis.org

0, 3, 12, 15, 48, 51, 60, 63, 192, 195, 204, 207, 240, 243, 252, 255, 768, 771, 780, 783, 816, 819, 828, 831, 960, 963, 972, 975, 1008, 1011, 1020, 1023, 3072, 3075, 3084, 3087, 3120, 3123, 3132, 3135, 3264, 3267, 3276, 3279, 3312, 3315, 3324, 3327, 3840, 3843
Offset: 0

Views

Author

N. J. A. Sloane, based on an email from Bart la Bastide (bart(AT)xs4all.nl)

Keywords

Comments

Numbers whose set of base 4 digits is {0,3}. - Ray Chandler, Aug 03 2004
n such that there exists a permutation p_1, ..., p_n of 1, ..., n such that i + p_i is a power of 4 for every i. - Ray Chandler, Aug 03 2004
The first 2^n terms of the sequence could be obtained using the Cantor-like process for the segment [0, 4^n-1]. E.g., for n=1 we have [0, {1, 2}, 3] such that numbers outside of braces are the first 2 terms of the sequence; for n=2 we have [0, {1, 2}, 3, {4, 5, 6, 7, 8, 9, 10, 11}, 12, {13, 14}, 15] such that the numbers outside of braces are the first 4 terms of the sequence, etc. - Vladimir Shevelev, Dec 17 2012
From Emeric Deutsch, Jan 26 2018: (Start)
Also, the indices of the compositions having only even parts. For the definition of the index of a composition, see A298644. For example, 195 is in the sequence since its binary form is 11000011 and the composition [2,4,2] has only even parts. 132 is not in the sequence since its binary form is 10000100 and the composition [1,4,1,2] also has odd parts.
The command c(n) from the Maple program yields the composition having index n. (End)
After the k-th step of generating the Koch snowflake curve, label the edges of the curve consecutively 0..3*4^k-1 starting from a vertex of the originating triangle. a(0), a(1), ... a(2^k-1) are the labels of the edges contained in one edge of the originating triangle. Add 4^k to each label to get the labels for the next edge of the triangle. Compare with A191108 in respect of the Sierpinski arrowhead curve. - Peter Munn, Aug 18 2019

Crossrefs

3 times the Moser-de Bruijn sequence A000695.
Two digits in other bases: A005823, A097252-A097262.
Digit duplication in other bases: A338086, A338754.
Main diagonal of A054238.
Cf. A191108.

Programs

  • C
    int a_next(int a_n) { int t = a_n << 1; return a_n ^ t ^ (t + 3); } /* Falk Hüffner, Jan 24 2022 */
  • Haskell
    a001196 n = if n == 0 then 0 else 4 * a001196 n' + 3 * b
                where (n',b) = divMod n 2
    -- Reinhard Zumkeller, Feb 21 2014
    
  • Maple
    Runs := proc (L) local j, r, i, k: j := 1: r[j] := L[1]: for i from 2 to nops(L) do if L[i] = L[i-1] then r[j] := r[j], L[i] else j := j+1: r[j] := L[i] end if end do: [seq([r[k]], k = 1 .. j)] end proc: RunLengths := proc (L) map(nops, Runs(L)) end proc: c := proc (n) ListTools:-Reverse(convert(n, base, 2)): RunLengths(%) end proc: A := {}: for n to 3350 do if type(product(1+c(n)[j], j = 1 .. nops(c(n))), odd) = true then A := `union`(A, {n}) else  end if end do: A; # most of the Maple  program is due to W. Edwin Clark. - Emeric Deutsch, Jan 26 2018
    # second Maple program:
    a:= proc(n) option remember;
         `if`(n<2, 3*n, 4*a(iquo(n, 2, 'r'))+3*r)
        end:
    seq(a(n), n=0..100);  # Alois P. Heinz, Jan 24 2022
  • Mathematica
    fQ[n_] := Union@ Mod[Length@# & /@ Split@ IntegerDigits[n, 2], 2] == {0}; Select[ Range@ 10000, fQ] (* Or *)
    fQ[n_] := Union@ Join[IntegerDigits[n, 4], {0, 3}] == {0, 3}; Select[ Range@ 10000, fQ] (* Robert G. Wilson v, Dec 24 2012 *)
  • PARI
    a(n) = 3*fromdigits(binary(n),4); \\ Kevin Ryde, Nov 07 2020
    
  • Python
    def inA001196(n):
        while n != 0:
            if n%4 == 1 or n%4 == 2:
                return 0
            n = n//4
        return 1
    n, a = 0, 0
    while n < 20:
        if inA001196(a):
            print(n,a)
            n = n+1
        a = a+1 # A.H.M. Smeets, Aug 19 2019
    
  • Python
    from itertools import groupby
    def ok2lb(n):
      if n == 0: return True  # by convention
      return all(len(list(g))%2 == 0 for k, g in groupby(bin(n)[2:]))
    print([i for i in range(3313) if ok2lb(i)]) # Michael S. Branicky, Jan 04 2021
    
  • Python
    def A001196(n): return 3*int(bin(n)[2:],4) # Chai Wah Wu, Aug 21 2023
    

Formula

a(2n) = 4*a(n), a(2n+1) = 4*a(n) + 3.
a(n) = 3 * A000695(n).
Sum_{n>=1} 1/a(n) = 0.628725478158702414849086504025451177643560169366348272891020450593453403709... (calculated using Baillie and Schmelzer's kempnerSums.nb, see Links). - Amiram Eldar, Feb 12 2022

A147991 Sequence S such that 1 is in S and if x is in S, then 3x-1 and 3x+1 are in S.

Original entry on oeis.org

1, 2, 4, 5, 7, 11, 13, 14, 16, 20, 22, 32, 34, 38, 40, 41, 43, 47, 49, 59, 61, 65, 67, 95, 97, 101, 103, 113, 115, 119, 121, 122, 124, 128, 130, 140, 142, 146, 148, 176, 178, 182, 184, 194, 196, 200, 202, 284, 286, 290, 292, 302, 304, 308, 310, 338, 340, 344, 346
Offset: 1

Views

Author

Clark Kimberling, Dec 07 2008

Keywords

Comments

Positive numbers that can be written in balanced ternary without a 0 trit. - J. Hufford, Jun 30 2015
Let S be the set of terms. Define c: Z -> P(R) so that c(m) is the translated Cantor ternary set spanning [m-0.5, m+0.5], and let C be the union of c(m) for all m in S U {0} U -S. C is the closure of the translated Cantor ternary set spanning [-0.5, 0.5] under multiplication by 3. - Peter Munn, Jan 31 2022

Examples

			0th generation: 1;
1st generation: 2 4;
2nd generation: 5 7 11 13.
		

Crossrefs

Cf. A006288, A351243 (non-quotients).
See also the related sequences listed in A191106.
One half of each position > 0 where A307744 sets or equals a record.
Cf. A030300.
Column k=3 of A360099.

Programs

  • Haskell
    import Data.Set (singleton, insert, deleteFindMin)
    a147991 n = a147991_list !! (n-1)
    a147991_list = f $ singleton 1 where
       f s = m : (f $ insert (3*m - 1) $ insert (3*m + 1) s')
             where (m, s') = deleteFindMin s
    -- Reinhard Zumkeller, Feb 21 2012, Jan 23 2011
    
  • Maple
    A147991:= proc(n) option remember; if n::even then 3*procname(n/2)-1 else 3*procname((n-1)/2)+1 fi end proc:
    A147991(1):= 1:
    [seq](A147991(i),i=1..1000); # Robert Israel, May 05 2014
  • Mathematica
    nn=346; s={1}; While[s1=Select[Union[s, 3*s-1, 3*s+1], # <= nn &];  s != s1, s=s1]; s
    a[ n_] := If[ n < -1 || n > 0, 3 a[Quotient[n, 2]] - (-1)^Mod[n, 2], 0]; (* Michael Somos, Dec 22 2018 *)
  • PARI
    {a(n) = if( n<-1 || n>0, 3*a(n\2) - (-1)^(n%2), 0)}; /* Michael Somos, Dec 22 2018 */
    
  • PARI
    a(n) = fromdigits(apply(b->if(b,1,-1),binary(n)), 3); \\ Kevin Ryde, Feb 06 2022

Formula

a(n) = 3*a(n/2) - 1 if n>=2 is even, 3*a((n-1)/2) + 1 if n is odd, a(0)=0. - Robert Israel, May 05 2014
G.f. g(x) satisfies g(x) = 3*(x+1)*g(x^2) + x/(1+x). - Robert Israel, May 05 2014
Product_{j=0..n-1} cos(3^j) = 2^(-n+1)*Sum_{i=2^(n-1)..2^n-1} cos(a(i)). - Gevorg Hmayakyan, Jan 15 2017
Sum_{i=2^(n-1)..2^n-1} cos(a(i)/3^(n-1)*Pi/2) = 0. - Gevorg Hmayakyan, Jan 15 2017
a(n) = -a(-1-n) for all n in Z. - Michael Somos, Dec 22 2018
For n > 0, A307744(2*a(2n)) = A307744(2*a(2n+1)) = A307744(2*a(n)) + 1. - Peter Munn, Jan 31 2022
a(n) mod 2 = A030300(n). - Alois P. Heinz, Jan 29 2023

A191106 Increasing sequence generated by these rules: a(1)=1, and if x is in a then 3x-2 and 3x are in a.

Original entry on oeis.org

1, 3, 7, 9, 19, 21, 25, 27, 55, 57, 61, 63, 73, 75, 79, 81, 163, 165, 169, 171, 181, 183, 187, 189, 217, 219, 223, 225, 235, 237, 241, 243, 487, 489, 493, 495, 505, 507, 511, 513, 541, 543, 547, 549, 559, 561, 565, 567, 649, 651, 655, 657, 667, 669, 673, 675, 703, 705, 709, 711, 721, 723, 727, 729, 1459, 1461, 1465, 1467, 1477
Offset: 1

Views

Author

Clark Kimberling, May 26 2011

Keywords

Comments

Related sequences for various choices of i and k as defined in A190803:
A003278: (i,k) = (-2,-1)
A191106: (i,k) = (-2, 0)
A191107: (i,k) = (-2, 1)
A191108: (i,k) = (-2, 2)
A153775: (i,k) = (-1, 0)
A147991: (i,k) = (-1, 1)
A191109: (i,k) = (-1, 2)
A005836: (i,k) = ( 0, 1)
A191110: (i,k) = ( 0, 2)
A132140: (i,k) = ( 1, 2)
For a=A191106, we have closure properties: the integers in (2+a)/3 comprise a; the integers in a/3 comprise a.
For k >= 1, m = a(i), 1 <= i <= 2^k seems to be m such that m/(3^k+1) is in the Cantor set (except that m = 0 and m = 3^k+1 do not appear). For k >= 2, m = (a(i)-1)/2, 1 <= i <= 2^k seems to be m such that m/((3^k-1)/2) is in the Cantor set. - Peter Munn, Jul 06 2019
Every even number is the sum of two (possibly equal) terms. More specifically: terms a(1) through a(2^n) = 3^n sum to even numbers 2 times 1 through 3^n. Every even number is infinitely often the difference of two terms. Since the sequence is equal to 2*A005836(n) + 1, these properties follow immediately from similar properties of A005836 for every number. - Aad Thoen, Feb 17 2022
if A_n=(a(1),a(2),...,a(2^n)), then A_(n+1)=(A_n,A_n+2*3^n), similar to A003278. - Arie Bos, Jul 26 2022

Examples

			1 -> 3 -> 7,9 -> 19,21,25,27 -> ...
		

Crossrefs

Cf. A005823, A005836, A054591, A088917 (characteristic function), A173934, A190803, A191108.
Partial sums of A061393.
Similar formula as A003278, A_(n+1)=(A_n,A_n+2*3^n).

Programs

  • Mathematica
    h = 3; i = -2; j = 3; k = 0; f = 1; g = 9;
    a = Union[Flatten[NestList[{h # + i, j # + k} &, f, g]]]  (* A191106; regarding g, see note at A190803 *)
    b = (a + 2)/3; c = a/3; r = Range[1, 900];
    d = Intersection[b, r](* illustrates closure property *)
    e = Intersection[c, r](* illustrates closure property *)
    2 FromDigits[#, 3]&/@Tuples[{0, 1}, 7] + 1 (* Vincenzo Librandi, Jul 10 2019 *)

Formula

a(n) = 2*A005836(n) + 1. - Charles R Greathouse IV, Sep 06 2011
a(n) = A005823(n) + 1. - Vladimir Shevelev, Dec 17 2012
a(n) = (A191108(n) + 1)/2. - Peter Munn, Jul 09 2019

A307672 The right half of a bi-infinite word invariant under the balanced morphism, {0->501, 1->210, 2->123, 3->432, 4->345, 5->054}, starting from axiom a(0)=0.

Original entry on oeis.org

0, 1, 2, 1, 0, 1, 2, 3, 2, 1, 0, 5, 0, 1, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1, 2, 3, 2, 1, 0, 5, 0, 1, 0, 5, 4, 5, 0, 1, 2, 1, 0, 1, 2, 3, 2, 1, 0, 5, 0, 1, 2, 1, 0, 1, 2, 3, 4, 3, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1, 2, 3, 2, 1, 0, 5, 0
Offset: 0

Views

Author

Bradley Klee and Peter Munn, Apr 20 2019

Keywords

Comments

The adjective "balanced" indicates that the fixed point a(0)=0 descends through iteration along a central dividing line, which bisects the ternary family tree into left and right halves, equal by node cardinality (see examples). From the original Gosper and Ziegler-Hunts reference (see links), a(k) = d(k) mod 6. The function d(k) draws left and right halves of the Sierpiński Arrowhead curve (see links). Alphanumeric transformation {0->a, 2->b, 4->c, 3->A, 5->B, 1->C} obtains d(k) in the form of lettered sets. By design, letters {a,b,c} occur only on even indices, while letters {A,B,C} occur only on odd indices. According to the principal eigenvector of the substitution system, occurrence tallies should asymptotically approach a uniform distribution over the six numbers or letters.
From Peter Munn, May 28 2019: (Start)
The sequence maps to half of an infinite Sierpinski arrowhead curve by mapping the values 0..5 to six unit vectors spaced at equal angles (Pi/3) in counterclockwise (or clockwise) order, then placing the vector image of each sequence term head to tail. Curve edges indexed 0..121 form the upper half of the curve in Figure 5 of the Gosper & Ziegler-Hunts reference (see links). The figure has the vector image of 0 pointing upwards, the red-colored segment runs from index -40 to +40 and the blue-colored segment from 41 to 121.
The arrowhead curve (both halves and continued to infinity) will align with an infinite Sierpinski gasket so that each of its edges is contained in the boundary of either the plane sector occupied by the gasket or a triangular region of the gasket's complement. Every length 3 segment of these boundaries contains exactly one edge of the arrowhead curve. See the link for the aligned curves.
For a given triangular boundary (or a given edge of the gasket sector boundary) the indices of the arrowhead edges it contains differ by multiples of 4. The edges in the gasket sector boundary are listed (absolute value of index) in A191108. Otherwise, edge n seems to be contained in a triangular boundary of side 2^(A307744(n)-1).
The arrowhead curve divides the plane into two regions. Denote the region that is wholly within the sector occupied by the gasket as the inside of the arrowhead. The curve's even-indexed edges are in triangular boundaries that lie inside the arrowhead, and the odd-indexed edges are not.
When the term-to-vector map described above is applied to the sequence bisections, we get related curves. The even-indexed curve reproduces the boundaries of all triangular regions of the gasket's complement, of unit side and greater, that lie inside the arrowhead; the odd-indexed curve reproduces the boundaries of the equivalent regions outside the arrowhead plus the gasket sector boundary. See the link for the aligned curves.
Recall that every length 3 boundary segment contains exactly one arrowhead edge. In the curve drawn by a(0), a(2), a(4), ... the image of a(6n) co-incides with the image of a(2n) in the arrowhead curve, and the images of a(6n-2), a(6n) and (6n+2) form a length 3 boundary segment. Similarly, in the curve drawn by a(1), a(3), a(5), ... the image of a(6n+3) co-incides with the image of a(2n+1) in the arrowhead curve, and the images of a(6n+1), a(6n+3) and a(6n+5) form a length 3 boundary segment.
One bisection produces vectors that draw triangular boundaries clockwise, the other counterclockwise. This must be so, because (1) the full sequence alternates odd and even, (2) opposite vectors are images of numbers with opposite parity, and (3) the gasket complement's triangular regions have the same orientation.
(End)

Examples

			The full ternary tree starts:
      0
     501
  054501210
		

Crossrefs

Lists that identify significant subsets of the Sierpinski arrowhead edges: A019989, A019990, A019991, A191108.
Cf. A156595 (draws the Sierpinski gasket).

Programs

  • Mathematica
    Arrowhead = {0->{5, 0, 1}, 1->{2, 1, 0}, 2->{1, 2, 3}, 3->{4, 3, 2}, 4->{3, 4, 5}, 5->{0, 5, 4}};
    aR[n_]:=Nest[Part[Flatten[#/.Arrowhead], 2;;-1]&,{0},n];aR[7]
    (* Second program: *)
    S = SubstitutionSystem[{0 -> {5, 0, 1}, 1 -> {2, 1, 0}, 2 -> {1, 2, 3}, 3 -> {4, 3, 2}, 4 -> {3, 4, 5}, 5 -> {0, 5, 4}}, {0}, 5][[-1]]; S[[Ceiling[ Length[S]/2];;]] (* Jean-François Alcover, May 08 2019 *)

A306556 Integers that appear as (unreduced) numerators of segment endpoints when a ternary Cantor set is created.

Original entry on oeis.org

0, 1, 2, 3, 6, 7, 8, 9, 18, 19, 20, 21, 24, 25, 26, 27, 54, 55, 56, 57, 60, 61, 62, 63, 72, 73, 74, 75, 78, 79, 80, 81, 162, 163, 164, 165, 168, 169, 170, 171, 180, 181, 182, 183, 186, 187, 188, 189, 216, 217, 218, 219, 222, 223, 224, 225, 234, 235, 236, 237, 240, 241, 242, 243
Offset: 1

Views

Author

Dan Dima, Feb 23 2019

Keywords

Comments

Nonnegative integers whose ternary representation contains only digits 0 and 2 except for at most a single digit 1 that is followed only by 0's.
Nonnegative integers that can be written in base 3 using only 0's and 2's, allowing the use of the "decimal" point (.) and replacing ....10..0(.) by ....02..2(.)2222...
Note that fractions are not reduced.
List of integers in the closure of the ternary Cantor set under multiplication by 3. The closure is the union of the translated ternary Cantor sets spanning [a(1), a(2)], [a(3), a(4)], [a(5), a(6)], ... . - Peter Munn, Jul 09 2019

Examples

			On 1st step we have [0,1/3] U [2/3,3/3] so we get a(1)=0, a(2)=1, a(3)=2, a(4)=3.
On 2nd step we have [0,1/9] U [2/9,3/9] U [6/9,7/9] U [8/9,9/9] so we get in addition a(5)=6, a(6)=7, a(7)=8, a(8)=9.
		

Crossrefs

Programs

  • PARI
    A306556(n) = {sm=0;while(n>1,ex=floor(log(n)/log(2));if(n-2^ex==0,sm=sm+3^(ex-1),sm=sm+2*3^(ex-1));n=n-2^ex);return(sm)}
    
  • PARI
    a(n) = n--; fromdigits(binary(n>>1),3)*2 + (n%2); \\ Kevin Ryde, Apr 23 2021

Formula

a(1)=0, a(2)=1;
a(2^n) = 3^(n-1) for n >= 1;
a(2^n+k) = 2*3^(n-1) + a(k) for 1 <= k <= 2^n.
From Peter Munn, Jul 09 2019: (Start)
a(2n-1) = A005823(n) = A191106(n)-1.
a(2n) = A191106(n) = A005823(n)+1.
a(2n-1) = (A055247(2n-1)-1)/3.
a(2n) = (A055247(2n) +1)/3.
a(2n-1) = (A191108(n)-1)/2.
a(2n) = (A191108(n)+1)/2.
(End)

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)).

Original entry on oeis.org

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

Views

Author

Peter Munn, Apr 26 2019

Keywords

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)

Examples

			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
		

Crossrefs

Sequences with similar definitions: A309054, A335933.
A055246, A191108, A306556 relate to the Cantor set.

Programs

  • 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

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)

A309054 a(1) = 0; for m >= 0, a(3m) = 1; for m >= 1, a(3m-1) = 2*a(m-1), a(3m+1) = 2*a(m+1).

Original entry on oeis.org

1, 0, 2, 1, 4, 0, 1, 2, 4, 1, 8, 2, 1, 0, 8, 1, 2, 0, 1, 4, 2, 1, 8, 4, 1, 2, 8, 1, 16, 2, 1, 4, 16, 1, 2, 4, 1, 0, 2, 1, 16, 0, 1, 2, 16, 1, 4, 2, 1, 0, 4, 1, 2, 0, 1, 8, 2, 1, 4, 8, 1, 2, 4, 1, 16, 2, 1, 8, 16, 1, 2, 8, 1, 4, 2, 1, 16, 4, 1, 2, 16, 1, 32, 2, 1
Offset: 0

Views

Author

Peter Munn, Jul 09 2019

Keywords

Comments

The sequence extends to negative n by defining a(n) = a(-n).
Consider 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 has side a(n). Every length 3 segment of these boundaries contains exactly one edge of the arrowhead curve. A191108 lists positive n such that edge n is contained in the plane sector boundary. See A307672 for further properties.
See the graphic (in the links) of the arrowhead curve aligned with the gasket. Note the even-indexed edges (colored red) are the edges contained in a triangular region boundary on the left side of the vector. - Peter Munn, Jul 29 2019
a(n) = 0 if A307744(n) = 0, otherwise a(n) = 2^(A307744(n) - 1). Thus, this sequence has the symmetries of A307744, which are similar to ruler functions (especially A051064) and described further in A307744.
When listening to this, set pitch modulus to 35 or 36.

Examples

			As 4 is congruent to 1 modulo 3, a(4) = a(3*1 + 1) = 2*a(1+1) = 2*a(2).
As 2 is congruent to -1 modulo 3, a(2) = a(3*1 - 1) = 2*a(1-1) = 2*a(0).
As 0 is congruent to 0 modulo 3, a(0) = 1.  So a(2) = 2*a(0) = 2*1 = 2.  So a(4) = 2*a(2) = 2*2 = 4.
		

Crossrefs

Formula

a(n) = 0 if A307744(n) = 0, otherwise a(n) = 2^(A307744(n) - 1).
a(A191108(i)) = 0 for i >= 1.
if a(n) = 2^k, a(3^(k+1)+n) = a(3^(k+1)-n) = 2^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 >= 1, let m_k = A034472(k-1) = 3^(k-1)+1.
a(n) < 2^k, for -m_k < n < m_k.
a(-m_k) = a(m_k) = 2^k.
(End)
Sum_{n=-3^k..3^k-1} (a(n) + 1) = 3 * 4^k.
Sum_{n=-3m..3m-1} (a(n) + 1) = 4 * Sum_{n=-m..m-1} (a(n) + 1) (conjectured).

A355680 Numerator generator for offsets from the quarter points of the Cantor ternary set to the center points of deleted middle thirds: 1 is in the list and if m is in the list -3m-4 and -3m+4 are in the list, which is ordered by absolute value.

Original entry on oeis.org

1, -7, 17, 25, -47, -55, -71, -79, 137, 145, 161, 169, 209, 217, 233, 241, -407, -415, -431, -439, -479, -487, -503, -511, -623, -631, -647, -655, -695, -703, -719, -727, 1217, 1225, 1241, 1249, 1289, 1297, 1313, 1321, 1433, 1441, 1457, 1465, 1505, 1513, 1529, 1537, 1865
Offset: 1

Views

Author

Peter Munn, Jul 14 2022

Keywords

Comments

At the (k+1)-th step of generating the Cantor set, the offsets from 1/4 to the center points of the deleted middle thirds are {a(i)/(4*(-3)^k) : 1 <= i <= 2^k}. Clearly, these offsets are negated for use with respect to 3/4.
Note that each quarter point of the Cantor ternary set, C, is also a quarter point of an interval-constrained subset of C that is an image of C scaled by 3^(-k) for all k >= 1.
If we replace -3m-4 and -3m+4 in the definition with -3m-2 and -3m+2 we get the terms of A191108 and their negation.

Examples

			At the 2nd step of generating the Cantor set, the deleted middle thirds are (1/9, 2/9) and (7/9, 8/9) with center points 1/6 and 5/6. These points are offset from 1/4 by -1/12 and +7/12. The denominator for the 2nd step (i.e., k=1) is 4*(-3)^k = -12. So a(1) = -1 * -1 = 1 and a(2) = 7 * -1 = -7.
		

Crossrefs

Essentially, the positions of isolated 0's in A355682.
Cf. A191108.

Programs

  • PARI
    A355680(size) = {a=vector(size); a[1] = 1;
    forstep (n=2,size,2, j=-3*a[n\2];
      if(j>0, a[n-1]=j-4;a[n]=j+4, a[n-1]=j+4;a[n]=j-4);
      print(n-1," ",a[n-1]); print(n," ",a[n]);) }
Showing 1-8 of 8 results.