%I #35 Mar 09 2023 13:18:08
%S 3,5,9,15,17,23,27,29,33,39,43,45,51,53,57,63,65,71,75,77,83,85,89,95,
%T 99,101,105,111,113,119,123,125,129,135,139,141,147,149,153,159,163,
%U 165,169,175,177,183,187,189,195,197,201,207,209,215,219,221,225,231,235
%N Evil odd numbers.
%C A heuristic argument suggests that, as n tends to infinity, a(n)/n converges to 4. - _Stefan Steinerberger_, May 17 2007
%C These numbers may be called primitive evil numbers because every evil number is a power of 2 multiplied by one of these numbers. Note that the difference between consecutive terms is either 2, 4, or 6. - _T. D. Noe_, Jun 06 2007
%C A132680(a(n)) = A132680((a(n)-1)/2) + 2. - _Reinhard Zumkeller_, Aug 26 2007
%C If m is in the sequence, then so is 2m-1 because in binary, m is x1 and 2m-1 is x01. Presumably the numbers that generate the whole sequence by application of n -> 2n-1 are the evil numbers times 4 plus 3. - _Ralf Stephan_, May 25 2013
%H T. D. Noe, <a href="/A129771/b129771.txt">Table of n, a(n) for n = 1..1000</a>
%F a(n) = 2*A000069(n) + 1. a(n) is 1 plus twice odious numbers. a(n) = A128309(n) + 1. a(n) is 1 plus odious even numbers.
%F a(n) = 4n + O(1). - _Charles R Greathouse IV_, Mar 21 2013
%F a(n) = A001969(1+A000069(n)) = A277902(A277823(n)). - _Antti Karttunen_, Nov 05 2016
%t Select[Range[300], OddQ[ # ] && EvenQ[DigitCount[ #, 2, 1]] &] (* _Stefan Steinerberger_, May 17 2007 *)
%t Select[Range[300], EvenQ[Plus @@ IntegerDigits[ #, 2]] && OddQ[ # ] &]
%o (PARI) is(n)=n%2 && hammingweight(n)%2==0 \\ _Charles R Greathouse IV_, Mar 21 2013
%o (PARI) a(n)=4*n-if(hammingweight(n-1)%2,3,1) \\ _Charles R Greathouse IV_, Mar 21 2013
%o (Python)
%o def A129771(n): return (((m:=n-1)<<1)+(m.bit_count()&1^1)<<1)+1 # _Chai Wah Wu_, Mar 09 2023
%Y This sequence is the intersection of A001969 (Evil numbers: even number of 1's in binary expansion.) and A005408 (The odd numbers: a(n) = 2n+1.) A093688 (Numbers n such that all divisors of n, excluding the divisor 1, have an even number of 1's in their binary expansions) is a subsequence.
%Y Cf. A092246 (odd odious numbers).
%Y Column 2 of A277880, positions of 1's in A277808 (2's in A277822).
%Y Cf. A000069, A128309, A277823, A277902.
%K nonn,easy
%O 1,1
%A _Tanya Khovanova_, May 16 2007
%E More terms from _Stefan Steinerberger_, May 17 2007