%I M1567 #116 Sep 07 2023 23:34:10
%S 0,2,6,8,18,20,24,26,54,56,60,62,72,74,78,80,162,164,168,170,180,182,
%T 186,188,216,218,222,224,234,236,240,242,486,488,492,494,504,506,510,
%U 512,540,542,546,548,558,560,564,566,648,650,654,656,666,668,672,674
%N Numbers whose ternary expansion contains no 1's.
%C The set of real numbers between 0 and 1 that contain no 1's in their ternary expansion is the well-known Cantor set with Hausdorff dimension log 2 / log 3.
%C Complement of A081606. - _Reinhard Zumkeller_, Mar 23 2003
%C Numbers k such that the k-th Apery number is congruent to 1 (mod 3) (cf. A005258). - _Benoit Cloitre_, Nov 30 2003
%C Numbers k such that the k-th central Delannoy number is congruent to 1 (mod 3) (cf. A001850). - _Benoit Cloitre_, Nov 30 2003
%C Numbers k such that there exists a permutation p_1, ..., p_k of 1, ..., k such that i + p_i is a power of 3 for every i. - _Ray Chandler_, Aug 03 2004
%C Subsequence of A125292. - _Reinhard Zumkeller_, Nov 26 2006
%C The first 2^n terms of the sequence could be obtained using the Cantor process for the segment [0,3^n-1]. E.g., for n=2 we have [0,{1},2,{3,4,5},6,{7},8]. The numbers outside of braces are the first 4 terms of the sequence. Therefore the terms of the sequence could be called "Cantor's numbers". - _Vladimir Shevelev_, Jun 13 2008
%C Mahler proved that positive a(n) is never a square. - _Michel Marcus_, Nov 12 2012
%C Define t: Z -> P(R) so that t(k) is the translated Cantor ternary set spanning [k, k+1], and let T be the union of t(a(n)) for all n. T = T * 3 = T / 3 is the closure of the Cantor ternary set under multiplication by 3. - _Peter Munn_, Oct 30 2019
%D K. J. Falconer, The Geometry of Fractal Sets, Cambridge, 1985; p. 14.
%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H Winston de Greef, <a href="/A005823/b005823.txt">Table of n, a(n) for n = 1..16384</a> (first 1024 terms from T. D. Noe)
%H J.-P. Allouche and J. Shallit, <a href="http://www.cs.uwaterloo.ca/~shallit/Papers/as0.ps">The ring of k-regular sequences</a>, Theoretical Computer Sci., Vol. 98, No. 2 (1992), pp. 163-197.
%H J.-P. Allouche and J. Shallit, <a href="http://dx.doi.org/10.1016/0304-3975(92)90001-V">The ring of k-regular sequences</a>, Theoretical Computer Sci., Vol. 98, No. 2 (1992), pp. 163-197.
%H Robert Baillie and Thomas Schmelzer, <a href="https://library.wolfram.com/infocenter/MathSource/7166/">Summing Kempner's Curious (Slowly-Convergent) Series</a>, Mathematica Notebook kempnerSums.nb, Wolfram Library Archive, 2008.
%H Sajed Haque, Chapter 3.4 of <a href="https://uwspace.uwaterloo.ca/bitstream/handle/10012/12234/Haque_Sajed.pdf">Discriminators of Integer Sequences</a>, 2017, See p. 45.
%H Sajed Haque and Jeffrey Shallit, <a href="http://arxiv.org/abs/1605.00092">Discriminators and k-Regular Sequences</a>, arXiv:1605.00092 [cs.DM], 2016.
%H Clark Kimberling, <a href="http://dx.doi.org/10.1016/S0012-365X(03)00085-2">Affinely recursive sets and orderings of languages</a>, Discrete Math., Vol. 274, No. 1-3 (2004), pp. 147-160.
%H Kurt Mahler, <a href="http://matwbn.icm.edu.pl/ksiazki/aa/aa53/aa5316.pdf">The representation of squares to the base 3</a>, Acta Arith., Vol. 53, Issue 1 (1989), pp. 99-106.
%H M. Mendes France and A. J. van der Poorten, <a href="http://dx.doi.org/10.1016/0304-3975(89)90045-5">From geometry to Euler identities</a>, Theoret. Comput. Sci., Vol. 65, No. 2 (1989), pp. 213-220.
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/CantorSet.html">Cantor Set</a>.
%H <a href="/index/Ar#3-automatic">Index entries for 3-automatic sequences</a>.
%F a(n) = 2 * A005836(n).
%F a(2n) = 3*a(n)+2, a(2n+1) = 3*a(n+1), a(1) = 0.
%F a(n) = Sum_{k = 1..n} 1 + 3^A007814(k). - _Philippe Deléham_, Jul 09 2005
%F A125291(a(n)) = 1 for n>0. - _Reinhard Zumkeller_, Nov 26 2006
%F From _Reinhard Zumkeller_, Mar 02 2008: (Start)
%F A062756(a(n)) = 0.
%F If the offset were changed to zero, then: a(0)=0, a(n+1)=f(a(n)+1,f(a(n)+1) where f(x,y) = if x<3 and x<>1 then y else if x mod 3 = 1 then f(y+1,y+1) else f(floor(x/3),y). (End)
%F G.f. g(x) satisfies g(x) = 3*g(x^2)*(1+1/x) + 2*x^2/(1-x^2). - _Robert Israel_, Jan 04 2015
%F Sum_{n>=2} 1/a(n) = 1.341426555483087715426958452292349687410838545707857407585878304836140592352... (calculated using Baillie and Schmelzer's kempnerSums.nb, see Links). - _Amiram Eldar_, Feb 12 2022
%p a:= proc(n) option remember;
%p `if`(n=1, 0, `if`(irem (n, 2, 'q')=0, 3*a(q)+2, 3*a(q+1)))
%p end:
%p seq(a(n), n=1..100); # _Alois P. Heinz_, Apr 19 2012
%t Select[ Range[ 0, 729 ], (Count[ IntegerDigits[ #, 3 ], 1 ]==0)& ]
%t Select[Range[0,700],DigitCount[#,3,1]==0&] (* _Harvey P. Dale_, Mar 12 2016 *)
%o (PARI) is(n)=while(n,if(n%3==1,return(0),n\=3));1 \\ _Charles R Greathouse IV_, Apr 20 2012
%o (PARI) a(n)=n=binary(n-1);sum(i=1,#n,2*n[i]*3^(#n-i)) \\ _Charles R Greathouse IV_, Apr 20 2012
%o (PARI) a(n)=2*fromdigits(binary(n-1),3) \\ _Charles R Greathouse IV_, Aug 24 2016
%o (Python)
%o def A005823(n):
%o return 2*int(format(n-1,'b'),3) # _Chai Wah Wu_, Jan 04 2015
%Y Twice A005836.
%Y Cf. A032924, A014263, A007089, A062756, A061392, A001196, A097252-A097262.
%Y Cf. A088917 (characteristic function), A306556.
%K nonn,easy,nice,look,base
%O 1,2
%A _N. J. A. Sloane_, _Jeffrey Shallit_
%E More terms from _Sascha Kurz_, Mar 24 2002
%E Offset corrected by _N. J. A. Sloane_, Mar 02 2008. This may require some of the formulas to be adjusted.