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-5 of 5 results.

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

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

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

Original entry on oeis.org

1, 2, 3, 5, 6, 8, 9, 14, 15, 17, 18, 23, 24, 26, 27, 41, 42, 44, 45, 50, 51, 53, 54, 68, 69, 71, 72, 77, 78, 80, 81, 122, 123, 125, 126, 131, 132, 134, 135, 149, 150, 152, 153, 158, 159, 161, 162, 203, 204, 206, 207, 212, 213, 215, 216, 230, 231, 233, 234, 239, 240, 242
Offset: 1

Views

Author

Clark Kimberling, Jan 02 2009

Keywords

Comments

Subsequences include A007051, A000244, A153773, A153774.
First generation: 1
2nd generation: 2, 3
3rd generation: 5, 6, 8, 9
4th generation: 14, 15, 17, 18, 23, 24, 26, 27
Does every generation contain a prime?
From Peter Munn, Feb 10 2022: (Start)
Consider a Sierpinski arrowhead curve formed of edges indexed 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. The numbers {4*a(n)-1 : n >= 1} (that is, 3, 7, 11, 19, 23, 31, 35, 55, 59, ...) index the edges that are contained in the boundaries of certain triangular regions: each is the first region encountered of each successively larger size that does not lie across the axis of symmetry.
Let S be the set of terms. Define c: N -> P(R) so that c(m) is the scaled and translated Cantor ternary set spanning [m-0.5, m], and let C be the union of c(m) for all m in S. C is the closure under multiplication by 3 of the scaled and translated Cantor ternary set spanning [0.5, 1.0].
(End)
Positive numbers whose balanced ternary expansions contain exactly one digit 1. - Rémy Sigrist, May 08 2022

Crossrefs

See also the related sequences listed in A191106.

Programs

  • Mathematica
    nxt[n_] := Flatten[3 # + {-1, 0} & /@ n]; Union[Flatten[NestList[nxt,{1},5]]] (* G. C. Greubel, Aug 28 2016 *)

Formula

From Peter Munn, Feb 04 2022: (Start)
For k >= 0, 2^k <= n <= 2^(k+1)-1, a(n) = A005836(n+1) - (3^k-1)/2.
For n >= 1, A307744(4*a(2n)-1) = A307744(4*a(2n+1)-1) = A307744(4*a(n)-1) + 1.
(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).

A335933 A fractal function, related to ruler functions. a(1) = 0; otherwise for m >= 0, a(3m) = 1, a(3m-1) = a(2m-1) + sign(a(2m-1)), a(3m+1) = a(2m+1) + sign(a(2m+1)).

Original entry on oeis.org

1, 0, 0, 1, 2, 2, 1, 3, 3, 1, 4, 4, 1, 2, 2, 1, 5, 5, 1, 3, 3, 1, 2, 2, 1, 6, 6, 1, 4, 4, 1, 2, 2, 1, 3, 3, 1, 7, 7, 1, 2, 2, 1, 5, 5, 1, 3, 3, 1, 2, 2, 1, 4, 4, 1, 8, 8, 1, 2, 2, 1, 3, 3, 1, 6, 6, 1, 2, 2, 1, 4, 4, 1, 3, 3, 1, 2, 2, 1, 5, 5, 1
Offset: 0

Views

Author

Peter Munn, Jun 30 2020

Keywords

Comments

We choose a form for the definition that shows clearly its relationship to A307744.
The odd bisection is essentially A087088.
If we add a(-1) = 0 to the definition and allow negative m (and therefore n), we get a symmetric function, that is a(n) = a(-n).
For k >= 1 numbers 1..k occur with the same periodic and mirror symmetries as in A307744 and in ruler function A051064. In A051064, k occurs 3 times more frequently than k+1. Here, and in A307744, k occurs 3/2 times more frequently than k+1, precisely 2^(k-1) times in every 3^k terms.

Crossrefs

Sequences with similar definitions: A205593, A307744.
A051064 has matching symmetries.
Odd bisection: A087088.

Programs

  • PARI
    a(n) = if (n==1, 0, if ((n%3) == 0, 1, if ((n%3)==1, my(k=(n-1)/3, aa = a(2*k+1)); aa+sign(aa),  my(k=(n+1)/3, aa = a(2*k-1)); aa+sign(aa)))); \\ Michel Marcus, Jul 03 2020
Showing 1-5 of 5 results.