%I #24 Jun 27 2021 14:55:17
%S 5,27,28,29,35,40,45,51,55,76,80,101,105,126,130,137,138,139,142,143,
%T 144,147,148,149,150,177,178,179,185,190,195,202,203,204,210,215,220,
%U 227,228,229,235,240,245,257,258,259,261,266,271,277,278,279,285,290
%N Numbers whose base-5 representation has the same nonzero number of 0's and 1's.
%t Select[Range[300],DigitCount[#,5,0]==DigitCount[#,5,1]>0&] (* _Harvey P. Dale_, Oct 16 2019 *)
%o (Python)
%o from sympy.ntheory import count_digits
%o def ok(n): c = count_digits(n, 5); return 0 in c and 1 in c and c[0] == c[1]
%o print(list(filter(ok, range(291)))) # _Michael S. Branicky_, May 27 2021
%o (PARI) is(n) = my(d=vecsort(digits(n, 5)), e=vector(#d), f=vector(#d, t, 1), side=#setintersect(d, e), sidf=#setintersect(d, f)); side==sidf && side > 0 \\ _Felix Fröhlich_, May 27 2021
%Y Cf. A031443, A039275, A039277, A039293, A039308, A039329, A039357, A039393, A039438, A039493.
%K nonn,base,easy
%O 1,1
%A _Olivier Gérard_
|