%I #37 Sep 08 2022 08:44:51
%S 1,2,5,6,9,10,21,22,25,26,37,38,41,42,85,86,89,90,101,102,105,106,149,
%T 150,153,154,165,166,169,170,341,342,345,346,357,358,361,362,405,406,
%U 409,410,421,422,425,426,597,598,601,602,613,614,617,618,661,662,665
%N Numbers whose set of base-4 digits is a subset of {1,2}.
%C Intersection of A023705 and A023717; A179888 is the intersection of this sequence and A053754. - _Reinhard Zumkeller_, Jul 31 2010
%H R. Zumkeller, <a href="/A032925/b032925.txt">Table of n, a(n) for n = 1..1000</a>
%F a(2n) = 4a(n-1) + 2, a(2n+1) = 4a(n) + 1. - _Ralf Stephan_, Oct 07 2003, corrected by _R. J. Mathar_, Sep 07 2016
%p A032925 := proc(n)
%p option remember;
%p if n <= 2 then
%p n;
%p else
%p if type(n,'even') then
%p 2+4*procname(n/2-1) ;
%p else
%p 1+4*procname(floor(n/2)) ;
%p end if;
%p end if;
%p end proc:
%p seq(A032925(n),n=1..100) ; # _R. J. Mathar_, Sep 07 2016
%t Flatten[Table[FromDigits[#,4]&/@Tuples[{1,2},n],{n,5}]] (* _Vincenzo Librandi_, Jun 05 2012 *)
%o (Magma) [n: n in [1..1000] | Set(IntegerToSequence(n, 4)) subset {1, 2}]; // _Vincenzo Librandi_, Jun 05 2012
%o (Haskell)
%o import Data.List (transpose)
%o a032925 n = a032925_list !! (n-1)
%o a032925_list = 1 : 2 : (concat $ transpose [map (+ 1) fs, map (+ 2) fs])
%o where fs = map (* 4) a032925_list
%o -- _Reinhard Zumkeller_, Apr 18 2015
%o (C)
%o uint32_t a_next(uint32_t a_n) {
%o uint32_t t = (a_n + 0x55555556) ^ 0x55555555;
%o return (a_n - t) & t;
%o } /* _Falk Hüffner_, Jan 22 2022 */
%Y Cf. A023705, A023717, A179888, A053754.
%K nonn,base,easy
%O 1,2
%A _Clark Kimberling_
|