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

A055247 Related to A055246 and A005836. Used for boundaries of open intervals which have to be erased in the Cantor middle third set construction.

Original entry on oeis.org

1, 2, 7, 8, 19, 20, 25, 26, 55, 56, 61, 62, 73, 74, 79, 80, 163, 164, 169, 170, 181, 182, 187, 188, 217, 218, 223, 224, 235, 236, 241, 242, 487, 488, 493, 494, 505, 506, 511, 512, 541, 542, 547, 548, 559, 560, 565, 566, 649, 650, 655, 656
Offset: 1

Views

Author

Wolfdieter Lang, May 23 2000

Keywords

Comments

At step number k >= 1 the 2^(k-1) open intervals which are erased from [0,1] in the Cantor middle third set construction are: I(k,n)=(a(2*n-1)/3^k,a(2*n)/3^k), n=1,.,2^(k-1).

Examples

			k=1: (1/3, 2/3); k=2: (1/9, 2/9), (7/9, 8/9); k=3: (1/27, 2/27), (7/27, 8/27), (19/27, 20/27), (25/27, 26/27); ...
		

Crossrefs

Formula

a(n)= A055246((n+1)/2) if n odd, a(n)= A055246(n/2)+1 if n even. A055246(n)= 1+6*A005836(n-1), n >= 1.
a(1) = 1, a(n) = 3^ceiling( log_2( n ) ) - a( 2^ceiling( log_2( n ) ) + 1 - n ). - Juan Jose Alba Gonzalez (jjalba(AT)gmail.com), May 16 2006

A005836 Numbers whose base-3 representation contains no 2.

Original entry on oeis.org

0, 1, 3, 4, 9, 10, 12, 13, 27, 28, 30, 31, 36, 37, 39, 40, 81, 82, 84, 85, 90, 91, 93, 94, 108, 109, 111, 112, 117, 118, 120, 121, 243, 244, 246, 247, 252, 253, 255, 256, 270, 271, 273, 274, 279, 280, 282, 283, 324, 325, 327, 328, 333, 334, 336, 337, 351, 352
Offset: 1

Views

Author

Keywords

Comments

3 does not divide binomial(2s, s) if and only if s is a member of this sequence, where binomial(2s, s) = A000984(s) are the central binomial coefficients.
This is the lexicographically earliest increasing sequence of nonnegative numbers that contains no arithmetic progression of length 3. - Robert Craigen (craigenr(AT)cc.umanitoba.ca), Jan 29 2001
In the notation of A185256 this is the Stanley Sequence S(0,1). - N. J. A. Sloane, Mar 19 2010
Complement of A074940. - Reinhard Zumkeller, Mar 23 2003
Sums of distinct powers of 3. - Ralf Stephan, Apr 27 2003
Numbers n such that central trinomial coefficient A002426(n) == 1 (mod 3). - Emeric Deutsch and Bruce E. Sagan, Dec 04 2003
A039966(a(n)+1) = 1; A104406(n) = number of terms <= n.
Subsequence of A125292; A125291(a(n)) = 1 for n>1. - Reinhard Zumkeller, Nov 26 2006
Also final value of n - 1 written in base 2 and then read in base 3 and with finally the result translated in base 10. - Philippe LALLOUET (philip.lallouet(AT)wanadoo.fr), Jun 23 2007
a(n) modulo 2 is the Thue-Morse sequence A010060. - Dennis Tseng, Jul 16 2009
Also numbers such that the balanced ternary representation is the same as the base 3 representation. - Alonso del Arte, Feb 25 2011
Fixed point of the morphism: 0 -> 01; 1 -> 34; 2 -> 67; ...; n -> (3n)(3n+1), starting from a(1) = 0. - Philippe Deléham, Oct 22 2011
It appears that this sequence lists the values of n which satisfy the condition sum(binomial(n, k)^(2*j), k = 0..n) mod 3 <> 0, for any j, with offset 0. See Maple code. - Gary Detlefs, Nov 28 2011
Also, it follows from the above comment by Philippe Lallouet that the sequence must be generated by the rules: a(1) = 0, and if m is in the sequence then so are 3*m and 3*m + 1. - L. Edson Jeffery, Nov 20 2015
Add 1 to each term and we get A003278. - N. J. A. Sloane, Dec 01 2019

Examples

			12 is a term because 12 = 110_3.
This sequence regarded as a triangle with rows of lengths 1, 1, 2, 4, 8, 16, ...:
   0
   1
   3,  4
   9, 10, 12, 13
  27, 28, 30, 31, 36, 37, 39, 40
  81, 82, 84, 85, 90, 91, 93, 94, 108, 109, 111, 112, 117, 118, 120, 121
... - _Philippe Deléham_, Jun 06 2015
		

References

  • Richard K. Guy, Unsolved Problems in Number Theory, 3rd Edition, Springer, 2004, Section E10, pp. 317-323.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A039966 (characteristic function).
For generating functions Product_{k>=0} (1+a*x^(b^k)) for the following values of (a,b) see: (1,2) A000012 and A000027, (1,3) A039966 and A005836, (1,4) A151666 and A000695, (1,5) A151667 and A033042, (2,2) A001316, (2,3) A151668, (2,4) A151669, (2,5) A151670, (3,2) A048883, (3,3) A117940, (3,4) A151665, (3,5) A151671, (4,2) A102376, (4,3) A151672, (4,4) A151673, (4,5) A151674.
Row 3 of array A104257.
Summary of increasing sequences avoiding arithmetic progressions of specified lengths (the second of each pair is obtained by adding 1 to the first):
3-term AP: A005836 (>=0), A003278 (>0);
4-term AP: A005839 (>=0), A005837 (>0);
5-term AP: A020654 (>=0), A020655 (>0);
6-term AP: A020656 (>=0), A005838 (>0);
7-term AP: A020657 (>=0), A020658 (>0);
8-term AP: A020659 (>=0), A020660 (>0);
9-term AP: A020661 (>=0), A020662 (>0);
10-term AP: A020663 (>=0), A020664 (>0).
See also A000452.

Programs

  • Haskell
    a005836 n = a005836_list !! (n-1)
    a005836_list = filter ((== 1) . a039966) [0..]
    -- Reinhard Zumkeller, Jun 09 2012, Sep 29 2011
    
  • Julia
    function a(n)
        m, r, b = n, 0, 1
        while m > 0
            m, q = divrem(m, 2)
            r += b * q
            b *= 3
        end
    r end; [a(n) for n in 0:57] |> println # Peter Luschny, Jan 03 2021
  • Maple
    t := (j, n) -> add(binomial(n,k)^j, k=0..n):
    for i from 1 to 400 do
        if(t(4,i) mod 3 <>0) then print(i) fi
    od; # Gary Detlefs, Nov 28 2011
    # alternative Maple program:
    a:= proc(n) option remember: local k, m:
    if n=1 then 0 elif n=2 then 1 elif n>2 then k:=floor(log[2](n-1)): m:=n-2^k: procname(m)+3^k: fi: end proc:
    seq(a(n), n=1.. 20); # Paul Weisenhorn, Mar 22 2020
    # third Maple program:
    a:= n-> `if`(n=1, 0, irem(n-1, 2, 'q')+3*a(q+1)):
    seq(a(n), n=1..100);  # Alois P. Heinz, Jan 26 2022
  • Mathematica
    Table[FromDigits[IntegerDigits[k, 2], 3], {k, 60}]
    Select[Range[0, 400], DigitCount[#, 3, 2] == 0 &] (* Harvey P. Dale, Jan 04 2012 *)
    Join[{0}, Accumulate[Table[(3^IntegerExponent[n, 2] + 1)/2, {n, 57}]]] (* IWABUCHI Yu(u)ki, Aug 01 2012 *)
    FromDigits[#,3]&/@Tuples[{0,1},7] (* Harvey P. Dale, May 10 2019 *)
  • PARI
    A=vector(100);for(n=2,#A,A[n]=if(n%2,3*A[n\2+1],A[n-1]+1));A \\ Charles R Greathouse IV, Jul 24 2012
    
  • PARI
    is(n)=while(n,if(n%3>1,return(0));n\=3);1 \\ Charles R Greathouse IV, Mar 07 2013
    
  • PARI
    a(n) = fromdigits(binary(n-1),3);  \\ Gheorghe Coserea, Jun 15 2018
    
  • Python
    def A005836(n):
        return int(format(n-1,'b'),3) # Chai Wah Wu, Jan 04 2015
    

Formula

a(n) = A005823(n)/2 = A003278(n)-1 = A033159(n)-2 = A033162(n)-3.
Numbers n such that the coefficient of x^n is > 0 in prod (k >= 0, 1 + x^(3^k)). - Benoit Cloitre, Jul 29 2003
a(n+1) = Sum_{k=0..m} b(k)* 3^k and n = Sum( b(k)* 2^k ).
a(2n+1) = 3a(n+1), a(2n+2) = a(2n+1) + 1, a(0) = 0.
a(n+1) = 3*a(floor(n/2)) + n - 2*floor(n/2). - Ralf Stephan, Apr 27 2003
G.f.: (x/(1-x)) * Sum_{k>=0} 3^k*x^2^k/(1+x^2^k). - Ralf Stephan, Apr 27 2003
a(n) = Sum_{k = 1..n-1} (1 + 3^A007814(k)) / 2. - Philippe Deléham, Jul 09 2005
From Reinhard Zumkeller, Mar 02 2008: (Start)
A081603(a(n)) = 0.
If the offset were changed to zero, then: a(0) = 0, a(n+1) = f(a(n)+1, a(n)+1) where f(x, y) = if x < 3 and x <> 2 then y else if x mod 3 = 2 then f(y+1, y+1) else f(floor(x/3), y). (End)
With offset a(0) = 0: a(n) = Sum_{k>=0} A030308(n,k)*3^k. - Philippe Deléham, Oct 15 2011
a(2^n) = A003462(n). - Philippe Deléham, Jun 06 2015
We have liminf_{n->infinity} a(n)/n^(log(3)/log(2)) = 1/2 and limsup_{n->infinity} a(n)/n^(log(3)/log(2)) = 1. - Gheorghe Coserea, Sep 13 2015
a(2^k+m) = a(m) + 3^k with 1 <= m <= 2^k and 1 <= k, a(1)=0, a(2)=1. - Paul Weisenhorn, Mar 22 2020
Sum_{n>=2} 1/a(n) = 2.682853110966175430853916904584699374821677091415714815171756609672281184705... (calculated using Baillie and Schmelzer's kempnerSums.nb, see Links). - Amiram Eldar, Feb 12 2022
A065361(a(n)) = n-1. - Rémy Sigrist, Feb 06 2023
a(n) ≍ n^k, where k = log 3/log 2 = 1.5849625007. (I believe the constant varies from 1/2 to 1.) - Charles R Greathouse IV, Mar 29 2024

Extensions

Offset corrected by N. J. A. Sloane, Mar 02 2008
Edited by the Associate Editors of the OEIS, Apr 07 2009

A003278 Szekeres's sequence: a(n)-1 in ternary = n-1 in binary; also: a(1) = 1, a(2) = 2, and thereafter a(n) is smallest number k which avoids any 3-term arithmetic progression in a(1), a(2), ..., a(n-1), k.

Original entry on oeis.org

1, 2, 4, 5, 10, 11, 13, 14, 28, 29, 31, 32, 37, 38, 40, 41, 82, 83, 85, 86, 91, 92, 94, 95, 109, 110, 112, 113, 118, 119, 121, 122, 244, 245, 247, 248, 253, 254, 256, 257, 271, 272, 274, 275, 280, 281, 283, 284, 325, 326, 328, 329, 334, 335, 337, 338, 352, 353
Offset: 1

Views

Author

Keywords

Comments

That is, there are no three elements A, B and C such that B - A = C - B.
Positions of 1's in Richard Stanley's Forest Fire sequence A309890. - N. J. A. Sloane, Dec 01 2019
Subtracting 1 from each term gives A005836 (ternary representation contains no 2's). - N. J. A. Sloane, Dec 01 2019
Difference sequence related to Gray code bit sequence (A001511). The difference patterns follows a similar repeating pattern (ABACABADABACABAE...), but each new value is the sum of the previous values, rather than simply 1 more than the maximum of the previous values. - Hal Burch (hburch(AT)cs.cmu.edu), Jan 12 2004
Sums of distinct powers of 3, translated by 1.
Positions of 0 in A189820; complement of A189822. - Clark Kimberling, May 26 2011
Also, Stanley sequence S(1): see OEIS Index under Stanley sequences (link below). - M. F. Hasler, Jan 18 2016
Named after the Hungarian-Australian mathematician George Szekeres (1911-2005). - Amiram Eldar, May 07 2021
If A_n=(a(1),a(2),...,a(2^n)), then A_(n+1)=(A_n,A_n+3^n). - Arie Bos, Jul 24 2022

Examples

			G.f. = x + 2*x^2 + 4*x^3 + 5*x^4 + 10*x^5 + 11*x^6 + 13*x^7 + 14*x^8 + 28*x^9 + ...
		

References

  • Steven R. Finch, Mathematical Constants, Cambridge, 2003, p. 164.
  • Richard K. Guy, Unsolved Problems in Number Theory, E10.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Equals 1 + A005836. Cf. A001511, A098871.
Row 0 of array in A093682.
Summary of increasing sequences avoiding arithmetic progressions of specified lengths (the second of each pair is obtained by adding 1 to the first):
3-term AP: A005836 (>=0), A003278 (>0);
4-term AP: A005839 (>=0), A005837 (>0);
5-term AP: A020654 (>=0), A020655 (>0);
6-term AP: A020656 (>=0), A005838 (>0);
7-term AP: A020657 (>=0), A020658 (>0);
8-term AP: A020659 (>=0), A020660 (>0);
9-term AP: A020661 (>=0), A020662 (>0);
10-term AP: A020663 (>=0), A020664 (>0).
Cf. A003002, A229037 (the Forest Fire sequence), A309890 (Stanley's version).
Similar formula:
If A_n=(a(1),a(2),...,a(2^n)), then A_(n+1)=(A_n,A_n+4^n) produces A098871;
If A_n=(a(1),a(2),...,a(2^n)), then A_(n+1)=(A_n,A_n+2*3^n) produces A191106.

Programs

  • Julia
    function a(n)
        return 1 + parse(Int, bitstring(n-1), base=3)
    end # Gabriel F. Lipnik, Apr 16 2021
  • Maple
    a:= proc(n) local m, r, b; m, r, b:= n-1, 1, 1;
          while m>0 do r:= r+b*irem(m, 2, 'm'); b:= b*3 od; r
        end:
    seq(a(n), n=1..100); # Alois P. Heinz, Aug 17 2013
  • Mathematica
    Take[ Sort[ Plus @@@ Subsets[ Table[3^n, {n, 0, 6}]]] + 1, 58] (* Robert G. Wilson v, Oct 23 2004 *)
    a[1] = 0; h = 180;
    Table[a[3 k - 2] = a[k], {k, 1, h}];
    Table[a[3 k - 1] = a[k], {k, 1, h}];
    Table[a[3 k] = 1, {k, 1, h}];
    Table[a[n], {n, 1, h}]   (* A189820 *)
    Flatten[Position[%, 0]]  (* A003278 *)
    Flatten[Position[%%, 1]] (* A189822 *)
    (* A003278 from A189820, from Clark Kimberling, May 26 2011 *)
    Table[FromDigits[IntegerDigits[n, 2], 3] + 1, {n, 0, 57}] (* Amit Munje, Jun 03 2018 *)
  • PARI
    a(n)=1+sum(i=1,n-1,(1+3^valuation(i,2))/2) \\ Ralf Stephan, Jan 21 2014
    
  • Perl
    $nxt = 1; @list = (); for ($cnt = 0; $cnt < 1500; $cnt++) { while (exists $legal{$nxt}) { $nxt++; } print "$nxt "; last if ($nxt >= 1000000); for ($i = 0; $i <= $#list; $i++) { $t = 2*$nxt - $list[$i]; $legal{$t} = -1; } $cnt++; push @list, $nxt; $nxt++; } # Hal Burch
    
  • Python
    def A003278(n):
        return int(format(n-1,'b'),3)+1 # Chai Wah Wu, Jan 04 2015
    

Formula

a(2*k + 2) = a(2*k + 1) + 1, a(2^k + 1) = 2*a(2^k).
a(n) = b(n+1) with b(0) = 1, b(2*n) = 3*b(n)-2, b(2*n+1) = 3*b(n)-1. - Ralf Stephan, Aug 23 2003
G.f.: x/(1-x)^2 + x * Sum_{k>=1} 3^(k-1)*x^(2^k)/((1-x^(2^k))*(1-x)). - Ralf Stephan, Sep 10 2003, corrected by Robert Israel, May 25 2011
Conjecture: a(n) = (A191107(n) + 2)/3 = (A055246(n) + 5)/6. - L. Edson Jeffery, Nov 26 2015
a(n) mod 2 = A010059(n). - Arie Bos, Aug 13 2022

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

Original entry on oeis.org

1, 4, 10, 13, 28, 31, 37, 40, 82, 85, 91, 94, 109, 112, 118, 121, 244, 247, 253, 256, 271, 274, 280, 283, 325, 328, 334, 337, 352, 355, 361, 364, 730, 733, 739, 742, 757, 760, 766, 769, 811, 814, 820, 823, 838, 841, 847, 850, 973, 976, 982, 985, 1000, 1003, 1009, 1012, 1054, 1057, 1063, 1066, 1081, 1084, 1090, 1093, 2188
Offset: 1

Views

Author

Clark Kimberling, May 26 2011

Keywords

Comments

For general discussions, see A190803 and A191106.
Numbers whose base-3 representation ends in 1 and contains no 2; primitive members of A005836. - Peter Munn, Aug 14 2023

Crossrefs

Programs

  • Maple
    N:= 100000: # to get all terms <= N
    with(queue):
    Q:= new(1):
    A:= {}:
    while not empty(Q) do
      s:= dequeue(Q);
      A:= A union {s};
      for t in {3*s-2,3*s+1} minus A do
        if t <= N then enqueue(Q,t) fi
      od
    od:
    sort(convert(A,list)); # Robert Israel, Nov 29 2015
  • Mathematica
    h = 3; i = -2; j = 3; k = 1; f = 1;  g = 7;
    a = Union[Flatten[NestList[{h # + i, j # + k} &, f, g]]]  (* A191107 *)
    b = (a + 2)/3; c = (a - 1)/3; r = Range[1, 900];
    d = Intersection[b, r] (* A003278 *)
    e = Intersection[c, r] (* A005836 *)

Formula

Conjecture: a(n) = 3*A003278(n) - 2 = (A055246(n) + 1)/2. - L. Edson Jeffery, Nov 25 2015
Conjecture: a(n) = A190640(n)/2. - Michel Marcus, Aug 24 2016
Conjecture: a(n) = A003278(2n-1). - Arie Bos, Aug 07 2022

A074939 Even numbers such that base 3 representation contains no 2.

Original entry on oeis.org

0, 4, 10, 12, 28, 30, 36, 40, 82, 84, 90, 94, 108, 112, 118, 120, 244, 246, 252, 256, 270, 274, 280, 282, 324, 328, 334, 336, 352, 354, 360, 364, 730, 732, 738, 742, 756, 760, 766, 768, 810, 814, 820, 822, 838, 840, 846, 850, 972, 976, 982, 984, 1000, 1002
Offset: 0

Views

Author

Benoit Cloitre, Oct 04 2002; Nov 15 2003

Keywords

Comments

Even numbers in A005836; n such that binomial(2n,n) == 1 (mod 3).
Sum of an even number of distinct powers of 3. - Emeric Deutsch, Dec 03 2003

Crossrefs

Intersection of A005843 and A005836.

Programs

  • Mathematica
    Select[2*Range[0,600],DigitCount[#,3,2]==0&] (* Harvey P. Dale, Dec 10 2016 *)
  • Python
    def A074939(n): return int(bin((n.bit_count()&1)+(n<<1))[2:],3) # Chai Wah Wu, Jun 26 2025

Formula

a(n) = A083094(n)/2; a(n) mod 3 = A010060(n); n such that coefficient of x^n equals 1 in Product_{k>=0} (1 - x^(3^k)).
a(n) + A074938(n) = A055246(n+1). - Philippe Deléham, Jul 10 2005

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)

A062548 Even integers that are not partial sums of A062547.

Original entry on oeis.org

2, 14, 38, 50, 110, 122, 146, 158, 326, 338, 362, 374, 434, 446, 470, 482, 974, 986, 1010, 1022, 1082, 1094, 1118, 1130, 1298, 1310, 1334, 1346, 1406, 1418, 1442, 1454, 2918, 2930, 2954, 2966, 3026, 3038, 3062, 3074, 3242, 3254, 3278, 3290, 3350, 3362
Offset: 0

Views

Author

Wouter Meeussen, Jun 26 2001

Keywords

Comments

Equals 2*A055246.

Crossrefs

Programs

  • Mathematica
    2+12*Table[FromDigits[IntegerDigits[k, 2], 3], {k, 0, 64}]

A112035 a(n) = Sum_{k=0..n} k*C(n,k)^2*C(n+k,k)^3, where C := binomial.

Original entry on oeis.org

0, 8, 540, 42576, 3675000, 334595040, 31539372732, 3046472028320, 299666635774704, 29894793786770040, 3016010007220052700, 307083034957464057600, 31506217163866419507000, 3253427167078021753747200, 337821983730064508845772700, 35246436592815103238009282880
Offset: 0

Views

Author

N. J. A. Sloane, Nov 28 2005

Keywords

Crossrefs

Cf. A055246 (indices where not multiple of 3), A112036.

Programs

  • Mathematica
    Table[Sum[k*Binomial[n, k]^2*Binomial[n + k, k]^3, {k, 0, n}], {n, 0, 20}] (* Vaclav Kotesovec, Jul 10 2021 *)
  • PARI
    a(n) = sum(k=0, n, k*binomial(n,k)^2*binomial(n+k,k)^3); \\ Michel Marcus, Mar 10 2016

A190640 Numbers whose base-3 expansion ends in 2 and does not contain any 1's.

Original entry on oeis.org

2, 8, 20, 26, 56, 62, 74, 80, 164, 170, 182, 188, 218, 224, 236, 242, 488, 494, 506, 512, 542, 548, 560, 566, 650, 656, 668, 674, 704, 710, 722, 728, 1460, 1466, 1478, 1484, 1514, 1520, 1532, 1538, 1622, 1628, 1640, 1646, 1676, 1682, 1694, 1700, 1946, 1952, 1964, 1970, 2000, 2006, 2018, 2024, 2108, 2114, 2126
Offset: 1

Views

Author

N. J. A. Sloane, May 15 2011

Keywords

Crossrefs

Subsequence of A005823.
Cf. A005836.

Programs

  • Mathematica
    Select[Range[2200],Last[IntegerDigits[#,3]]==2&&DigitCount[#,3,1]==0&] (* Harvey P. Dale, Sep 09 2012 *)
    FromDigits[#,3]&/@(Join[#,{2}]&/@Tuples[{0,2},7]) (* Harvey P. Dale, Jul 25 2020 *)
  • PARI
    is(n)=n%3==2 && setsearch(Set(digits(n,3)), 1)==0 \\ Charles R Greathouse IV, Aug 24 2016
    
  • PARI
    a(n)=2*fromdigits(binary(2*n-1),3) \\ Charles R Greathouse IV, Aug 24 2016

Formula

Conjecture: a(n) = A055246(n) + 1. - Michel Marcus, Aug 24 2016
a(n) = A005823(2n). - Charles R Greathouse IV, Aug 24 2016

A265159 Rectangular array A read by upward antidiagonals in which the entry in row n and column k is defined by A(n,k) = 5 + 9*A005836(2^(k - 1)*(2 n - 1)), n,k >= 1.

Original entry on oeis.org

5, 32, 14, 86, 95, 41, 113, 257, 284, 122, 248, 338, 770, 851, 365, 275, 743, 1013, 2309, 2552, 1094, 329, 824, 2228, 3038, 6926, 7655, 3281, 356, 986, 2471, 6683, 9113, 20777, 22964, 9842, 734, 1067, 2957, 7412, 20048, 27338, 62330, 68891, 29525
Offset: 1

Views

Author

L. Edson Jeffery, Dec 03 2015

Keywords

Comments

Conjecture 1: The array contains without duplication all possible "block numbers" defined in A265100.

Examples

			Array A begins:
.      5    14    41    122    365    1094    3281     9842    29525
.     32    95   284    851   2552    7655   22964    68891   206672
.     86   257   770   2309   6926   20777   62330   186989   560966
.    113   338  1013   3038   9113   27338   82013   246038   738113
.    248   743  2228   6683  20048   60143  180428   541283  1623848
.    275   824  2471   7412  22235   66704  200111   600332  1800995
.    329   986  2957   8870  26609   79826  239477   718430  2155289
.    356  1067  3200   9599  28796   86387  259160   777479  2332436
.    734  2201  6602  19805  59414  178241  534722  1604165  4812494
		

Crossrefs

Programs

  • Mathematica
    (* Array: *)
    a005836[1] := 0; a005836[n_] := If[OddQ[n], 3*a005836[Floor[(n + 1)/2]], a005836[n - 1] + 1]; a265159[n_, k_] := 5 + 9*a005836[2^(k - 1)*(2 n - 1)]; Grid[Table[a265159[n, k], {n, 9}, {k, 9}]]
    (* Array antidiagonals flattened: *)
    a005836[1] := 0; a005836[n_] := If[OddQ[n], 3*a005836[Floor[(n + 1)/2]], a005836[n - 1] + 1]; a265159[n_, k_] := 5 + 9*a005836[2^(k - 1)*(2 n - 1)]; Flatten[Table[a265159[n - k + 1, k], {n, 9}, {k, n}]]

Formula

Conjecture 2: A(n,k) = (A055246(n)*3^k + 1)/2, so the array and A265100 are related to Cantor's ternary set.
G.f. for row n (conjectured): f(n,x) = x*(A265100(n)-(A265100(n)+1)*x)/((1-x)*(1-3*x)).
Showing 1-10 of 10 results.