login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A276194
Odd numbers whose binary representation contains an even number of 1's and at least one 0.
2
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,1
FORMULA
a(2^n - floor(n/2)) = 4*2^n + 1, for all n >= 0. - Gheorghe Coserea, Oct 24 2016
EXAMPLE
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.
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}]
PROG
(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
CROSSREFS
Cf. A005408.
Intersection of A129771 and A062289.
Sequence in context: A095725 A005006 A369318 * A157970 A054278 A210978
KEYWORD
nonn,base
AUTHOR
Lei Zhou, Oct 20 2016
STATUS
approved