%I #15 May 27 2023 20:37:14
%S 512,1026,1032,1056,1152,1536,2049,2051,2052,2060,2064,2096,2112,2240,
%T 2304,2816,3074,3080,3104,3200,3584,4102,4105,4107,4110,4114,4120,
%U 4129,4131,4132,4140,4146,4152,4162,4168,4192,4225
%N Numbers whose base-4 representation contains exactly four 0's and one 2.
%H Robert Israel, <a href="/A045058/b045058.txt">Table of n, a(n) for n = 1..10000</a>
%p dmax:= 8: # to get all terms < 4^dmax
%p T[1,1,0]:= {}: T[1,0,1]:= {2}: T[1,0,0]:= {1,3}:
%p for d from 2 to dmax do
%p for a from 0 to max(d-1,4) do
%p for b from 0 to max(d-a,1) do
%p T[d,a,b]:= {}:
%p if a + b <= d-1 and a < d-1 then
%p T[d,a,b]:= T[d,a,b] union map(t -> (4*t+1,4*t+3), T[d-1,a,b])
%p fi;
%p if a >= 1 then
%p T[d,a,b]:= T[d,a,b] union map(t -> 4*t, T[d-1,a-1,b])
%p fi;
%p if b >= 1 and a < d-1 then
%p T[d,a,b]:= T[d,a,b] union map(t -> 4*t+2, T[d-1,a,b-1])
%p fi;
%p od od od:
%p sort([seq](op(T[d,4,1]),d=5..dmax)); # _Robert Israel_, Jun 29 2017
%t Select[Range[4500],DigitCount[#,4,0]==4&&DigitCount[#,4,2]==1&] (* _Harvey P. Dale_, May 26 2018 *)
%Y Cf. A007090.
%K nonn,base
%O 1,1
%A _Clark Kimberling_
|