%I #17 May 13 2023 18:02:24
%S 15,31,51,55,60,61,79,95,115,119,124,125,195,199,204,205,211,215,220,
%T 221,240,241,244,245,271,287,307,311,316,317,335,351,371,375,380,381,
%U 451,455,460,461,467,471,476,477,496,497,500
%N Numbers whose base-4 representation contains no 2's and exactly two 3's.
%H Robert Israel, <a href="/A045135/b045135.txt">Table of n, a(n) for n = 1..10000</a>
%p f:= proc(d) # for terms < 4^d
%p local L, x1, x2, i,S, R;
%p R:= NULL;
%p for x2 from 1 to d-1 do
%p for x1 from 0 to x2-1 do
%p for S in combinat:-powerset({$0..x1-1, $x1+1..x2-1, $x2+1..d-1}) do
%p R:= R, add(4^i,i=S)+3*4^x1+3*4^x2;
%p od od od:
%p sort([R]);
%p end proc:
%p f(5); # _Robert Israel_, Feb 25 2021
%t Select[Range[500],DigitCount[#,4,2]==0&&DigitCount[#,4,3]==2&] (* _Harvey P. Dale_, Jul 24 2016 *)
%o (PARI) isok(k) = my(d=digits(k, 4)); (#select(x->(x==2), d) == 0) && (#select(x->(x==3), d) == 2); \\ _Michel Marcus_, Feb 25 2021
%Y Cf. A007090 (numbers in base 4).
%K nonn,base
%O 1,1
%A _Clark Kimberling_
|