A276194 Odd numbers whose binary representation contains an even number of 1's and at least one 0.
5, 9, 17, 23, 27, 29, 33, 39, 43, 45, 51, 53, 57, 65, 71, 75, 77, 83, 85, 89, 95, 99, 101, 105, 111, 113, 119, 123, 125, 129, 135, 139, 141, 147, 149, 153, 159, 163, 165, 169, 175, 177, 183, 187, 189, 195, 197, 201, 207, 209, 215, 219, 221, 225, 231, 235, 237
Offset: 1
Examples
Binary expansions of odd integers in decimal and binary forms are as follows: 1 -> 1, no; 3 -> 11, no; 5 -> 101, yes, so a(1)=5; 7 -> 111, no; 9 -> 1001, yes so a(2)=9; 11 -> 1011, no; 13 -> 1101, no; 15 -> 1111, no; 17 -> 10001, yes so a(3)=17.
Links
Programs
-
Mathematica
BNDigits[m_Integer] := Module[{n = m, d, t = {}}, While[n > 0, d = Mod[n, 2]; PrependTo[t, d]; n = (n - d)/2]; t]; c = 1; Table[While[c = c + 2; d = BNDigits[c]; ld = Length[d]; c1 = Total[d]; ! (EvenQ[c1] && (c1 < ld))]; c, {n, 1, 57}]
-
PARI
isok(n) = my(b=binary(n)); (n % 2) && (vecmin(b)==0) && !(vecsum(b) % 2); \\ Michel Marcus, Oct 21 2016
-
PARI
seq(N) = { my(bag = List(), cnt = 0, n = 1); while(cnt < N, if (hammingweight(n)%2 == 0 && hammingweight(n+1) > 1, listput(bag, n); cnt++); n += 2); return(Vec(bag)); }; seq(57) \\ Gheorghe Coserea, Oct 25 2016
Formula
a(2^n - floor(n/2)) = 4*2^n + 1, for all n >= 0. - Gheorghe Coserea, Oct 24 2016