login
Numbers whose ternary expansion contains no 0.
41

%I #73 Oct 13 2023 11:30:37

%S 1,2,4,5,7,8,13,14,16,17,22,23,25,26,40,41,43,44,49,50,52,53,67,68,70,

%T 71,76,77,79,80,121,122,124,125,130,131,133,134,148,149,151,152,157,

%U 158,160,161,202,203,205,206,211,212,214,215,229,230,232,233,238,239

%N Numbers whose ternary expansion contains no 0.

%C Complement of A081605. - _Reinhard Zumkeller_, Mar 23 2003

%C Subsequence of A154314. - _Reinhard Zumkeller_, Jan 07 2009

%C The first 28 terms are the range of A059852 (Morse codes for letters, when written in base 3) union {44, 50} (which correspond to Morse codes of Ü and Ä). Subsequent terms represent the Morse code of other symbols in the same coding. - _M. F. Hasler_, Jun 22 2020

%H Reinhard Zumkeller, <a href="/A032924/b032924.txt">Table of n, a(n) for n = 1..10000</a>

%H David Garth and Adam Gouge, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL10/Garth/garth14.html">Affinely Self-Generating Sets and Morphisms</a>, Journal of Integer Sequences, 10 (2007), Article 07.1.5., 1-13.

%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., 274 (2004), 147-160.

%H <a href="/index/Ar#3-automatic">Index entries for 3-automatic sequences</a>.

%F a(n) = A107680(n) + A107681(n). - _Reinhard Zumkeller_, May 20 2005

%F A081604(A107681(n)) <= A081604(A107680(n)) = A081604(a(n)) = A000523(n+1). - _Reinhard Zumkeller_, May 20 2005

%F A077267(a(n)) = 0. - _Reinhard Zumkeller_, Mar 02 2008

%F a(1)=1, a(n+1) = f(a(n)+1,f(a(n)+1) where f(x,y) = if x<3 and x<>0 then y, else if x mod 3 = 0 then f(y+1,y+1), else f(floor(x/3),y). - _Reinhard Zumkeller_, Mar 02 2008

%F a(2*n) = a(2*n-1)+1, n>0. - _Zak Seidov_, Jul 27 2009

%F A212193(a(n)) = 0. - _Reinhard Zumkeller_, May 04 2012

%F a(2*n+1) = 3*a(n)+1. - _Robert Israel_, Aug 05 2015

%F G.f.: x/(1-x)^2 + Sum_{m >= 1} 3^(m-1)*x^(2^(m+1)-1)/((1-x^(2^m))*(1-x))). - _Robert Israel_, Aug 04 2015

%F A065361(a(n)) = n. - _Rémy Sigrist_, Feb 06 2023

%p f:= proc(n) local L,i,m;

%p L:= convert(n,base,2);

%p m:= nops(L);

%p add((1+L[i])*3^(i-1),i=1..m-1);

%p end proc:

%p map(f, [$2..101]); # _Robert Israel_, Aug 04 2015

%t Select[Range@ 240, Last@ DigitCount[#, 3] == 0 &] (* _Michael De Vlieger_, Aug 05 2015 *)

%t Flatten[Table[FromDigits[#,3]&/@Tuples[{1,2},n],{n,5}]] (* _Harvey P. Dale_, May 28 2016 *)

%o (Haskell)

%o a032924 n = a032924_list !! (n-1)

%o a032924_list = iterate f 1 where

%o f x = 1 + if r < 2 then x else 3 * f x' where (x', r) = divMod x 3

%o -- _Reinhard Zumkeller_, Mar 07 2015, May 04 2012

%o (PARI) apply( {A032924(n)=if(n<3,n,3*self()((n-1)\2)+2-n%2)}, [1..99]) \\ _M. F. Hasler_, Jun 22 2020

%o (PARI) a(n) = fromdigits(apply(d->d+1,binary(n+1)[^1]), 3); \\ _Kevin Ryde_, Jun 23 2020

%o (Python)

%o def a(n): return sum(3**i*(int(b)+1) for i, b in enumerate(bin(n+1)[:2:-1]))

%o print([a(n) for n in range(1, 61)]) # _Michael S. Branicky_, Aug 15 2022

%o (Python)

%o def is_A032924(n):

%o while n > 2:

%o n,r = divmod(n,3)

%o if r==0: return False

%o return n > 0

%o print([n for n in range(250) if is_A032924(n)]) # _M. F. Hasler_, Feb 15 2023

%o (Python)

%o def A032924(n): return int(bin(m:=n+1)[3:],3) + (3**(m.bit_length()-1)-1>>1) # _Chai Wah Wu_, Oct 13 2023

%Y Cf. A005823, A005836, A065361, A007089, A081608, A132140, A132141.

%Y Zeroless numbers in some other bases <= 10: A000042 (base 2), A023705 (base 4), A248910 (base 6), A255805 (base 8), A255808 (base 9), A052382 (base 10).

%K nonn,base,easy

%O 1,2

%A _Clark Kimberling_