%I #41 Jan 24 2022 09:32:09
%S 0,1,2,4,5,6,8,9,10,16,17,18,20,21,22,24,25,26,32,33,34,36,37,38,40,
%T 41,42,64,65,66,68,69,70,72,73,74,80,81,82,84,85,86,88,89,90,96,97,98,
%U 100,101,102,104,105,106,128,129,130,132,133,134,136,137,138
%N Numbers with no 3's in base-4 expansion.
%C A032925 is the intersection of this sequence and A023705; cf. A179888. - _Reinhard Zumkeller_, Jul 31 2010
%C Fixed point of the morphism: 0-> 0,1,2; 1-> 4,5,6; 2-> 8,9,10; ...; n-> 4n,4n+1,4n+2. - _Philippe Deléham_, Oct 22 2011
%H Reinhard Zumkeller, <a href="/A023717/b023717.txt">Table of n, a(n) for n = 0..10000</a>
%F a(n) = Sum_{i=0..m} d(i)*4^i, where Sum_{i=0..m} d(i)*3^i is the base-3 representation of n. - _Clark Kimberling_
%F a(3n) = 4*a(n); a(3n+1) = 4*a(n)+1; a(3n+2) = 4*a(n)+2; a(n) = 4*a(floor(n/3)) + n - 3*floor(n/3). - _Benoit Cloitre_, Apr 27 2003
%F a(n) = Sum_{k>=0} A030341(n,k)*4^k. - _Philippe Deléham_, Oct 22 2011
%t Select[ Range[ 0, 140 ], (Count[ IntegerDigits[ #, 4 ], 3 ]==0)& ]
%o (PARI) a(n)=if(n<1,0,if(n%3,a(n-1)+1,4*a(n/3))) or a(n)=if(n<1,0,4*a(floor(n/3))+n-3*floor(n/3))
%o (Haskell)
%o a023717 n = a023717_list !! (n-1)
%o a023717_list = filter f [0..] where
%o f x = x < 3 || (q < 3 && f x') where (x', q) = divMod x 4
%o -- _Reinhard Zumkeller_, Apr 18 2015
%o (Julia)
%o function a(n)
%o m, r, b = n, 0, 1
%o while m > 0
%o m, q = divrem(m, 3)
%o r += b * q
%o b *= 4
%o end
%o r end; [a(n) for n in 0:58] |> println # _Peter Luschny_, Jan 03 2021
%o (C)
%o uint32_t a_next(uint32_t a_n) {
%o uint32_t t = ((a_n ^ 0xaaaaaaaa) | 0x55555555) >> 1;
%o return (a_n - t) & t;
%o } // _Falk Hüffner_, Jan 22 2022
%Y Cf. A032925, A023705, A179888.
%K nonn,base,easy
%O 0,3
%A _Olivier Gérard_
|