%I #18 Jun 28 2021 04:35:52
%S 6,11,15,19,21,32,34,38,42,46,48,56,58,60,64,66,72,89,95,97,101,103,
%T 105,113,115,119,123,127,129,137,139,141,145,147,153,167,169,173,175,
%U 177,181,183,191,193,195,199,201,207,217,219,225,260,266,268,278,284
%N Numbers whose base-3 representation has the same nonzero number of 0's and 2's.
%t Select[Range[300],DigitCount[#,3,0]==DigitCount[#,3,2]>0&] (* _Harvey P. Dale_, May 10 2011 *)
%o (Python)
%o from sympy.ntheory import count_digits
%o def ok(n): d = count_digits(n, 3); return 0 in d and 2 in d and d[0] == d[2]
%o print(list(filter(ok, range(285)))) # _Michael S. Branicky_, Jun 11 2021
%Y Supersequence of A044995.
%Y Cf. A007089, A005823.
%K nonn,base,easy
%O 1,1
%A _Olivier GĂ©rard_
|