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

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)

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)

A308364 a(0) = 0, a(3n) = a(n), a(3n+1) = a(n)*3 + 1, a(3n-1) = a(n)*3 - 1.

Original entry on oeis.org

0, 1, 2, 1, 4, 5, 2, 7, 2, 1, 4, 11, 4, 13, 14, 5, 16, 5, 2, 7, 20, 7, 22, 5, 2, 7, 2, 1, 4, 11, 4, 13, 32, 11, 34, 11, 4, 13, 38, 13, 40, 41, 14, 43, 14, 5, 16, 47, 16, 49, 14, 5, 16, 5, 2, 7, 20, 7, 22, 59, 20, 61, 20, 7, 22, 65, 22, 67, 14, 5, 16, 5, 2, 7, 20, 7, 22, 5, 2, 7, 2, 1
Offset: 0

Views

Author

Peter Munn, May 22 2019

Keywords

Comments

Defines a function on all the integers, but only nonnegative terms are in the data. A147991 gives the nonnegative fixed points of the function and the nonnegative part of its image.
Consider a Sierpinski arrowhead curve to be formed of vectors placed head to tail and numbered consecutively from 0 at its axis of symmetry. Vector a(n) equals vector n.
Removing all 0's from the balanced ternary expansion of n yields a(n). - Charlie Neder, Jun 03 2019

Examples

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

Crossrefs

Programs

  • Magma
    a:=[1]; for n in [2..80] do  if n mod 3 eq 2 then a[n]:= 3*a[(n+1) div 3]-1; end if; if n mod 3 eq 1 then a[n]:=3*a[(n-1) div 3]+1; end if; if n mod 3 eq 0 then a[n]:=a[n div 3]; end if; end for; [0] cat a; // Marius A. Burtea, Nov 14 2019
  • PARI
    a(n) = if (n == 0, 0, r = n%3; if (r==0, a(n/3), if (r==1, 3*a((n-1)/3)+1, 3*a((n+1)/3)-1))); \\ Michel Marcus, May 29 2019
    

Formula

a(-n) = - a(n).
A307672(a(n)) = A307672(n).
a(A147991(n)) = A147991(n).
a(9n-1) = a(9n-3). a(9n+1) = a(9n+3).
Showing 1-3 of 3 results.