A272698 Powers of 2 with exactly one even decimal digit.
2, 4, 8, 16, 32, 512
Offset: 1
Programs
-
Mathematica
Select[2^Range[0, 50000], Total@ Pick[DigitCount@ #, {0, 1, 0, 1, 0, 1, 0, 1, 0, 1}, 1] == 1 &] (* Michael De Vlieger, May 04 2016 *) Select[2^Range[200],Count[IntegerDigits[#],?EvenQ]==1&] (* _Harvey P. Dale, Aug 20 2017 *)
-
PARI
is(n)=my(d=digits(n)); n>1 && n>>valuation(n,2)==1 && sum(i=1,#d,d[i]%2==0)==1 \\ Charles R Greathouse IV, May 04 2016
-
Ruby
ary = [] s = 1 (1..10 ** 4).each{|i| s *= 2 j = s.to_s.split('').map(&:to_i).select{|i| i % 2 == 0}.size ary << s if j == 1 } p ary
Comments