login
Odd "odious" numbers (A000069).
24

%I #41 Mar 03 2023 17:14:36

%S 1,7,11,13,19,21,25,31,35,37,41,47,49,55,59,61,67,69,73,79,81,87,91,

%T 93,97,103,107,109,115,117,121,127,131,133,137,143,145,151,155,157,

%U 161,167,171,173,179,181,185,191,193,199,203,205,211,213,217,223,227,229,233

%N Odd "odious" numbers (A000069).

%C In other words, numbers having a binary representation ending in 1, and an odd number of 1's overall. It follows that by decrementing an odd odious number, one gets an even evil number (A125592). - _Ralf Stephan_, Aug 27 2013

%C The members of the sequence may be called primitive odious numbers because every odious number is a power of 2 times one of these numbers. Note that the difference between consecutive terms is either 2, 4, or 6. - _T. D. Noe_, Jun 06 2007

%C From _Gary W. Adamson_, Apr 06 2010: (Start)

%C a(n) = A026147(n)-th odd number, where A026147 = (1, 4, 6, 7, 10, 11, ...); e.g.,

%C n: 1 2 3 4 5 6 7 8 9 10 11

%C n-th odd: 1 3 5 7 9 11 13 15 17 19 21

%C a(n): 1 7 11 13 19 21

%C etc. (End)

%C Numbers m, such that when merge-sorting lists of length m, the maximal number of comparisons is even: A003071(a(n)) = A230720(n). - _Reinhard Zumkeller_, Oct 28 2013

%C Fixed points of permutation pair A268717/A268718. - _Antti Karttunen_, Feb 29 2016

%H T. D. Noe, <a href="/A092246/b092246.txt">Table of n, a(n) for n = 1..1000</a>

%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>

%H <a href="/index/So#sorting">Index entries for sequences related to sorting</a>

%F a(n) = 4*n + 2*A010060(n-1) - 3;

%F a(n) = 2*A001969(n-1) + 1.

%t Table[If[n < 1, 0, 2 n - 1 - Mod[First@ DigitCount[n - 1, 2], 2]], {n, 120}] /. n_ /; EvenQ@ n -> Nothing (* _Michael De Vlieger_, Feb 29 2016 *)

%t Select[Range[1, 1001, 2], OddQ[Total[IntegerDigits[#, 2]]]&] (* _Jean-François Alcover_, Mar 15 2016 *)

%o (PARI) is(n)=n%2&&hammingweight(n)%2 \\ _Charles R Greathouse IV_, Mar 21 2013

%o (PARI) a(n)=4*n-if(hammingweight(n-1)%2,1,3) \\ _Charles R Greathouse IV_, Mar 22 2013

%o (Haskell)

%o a092246 n = a092246_list !! (n - 1)

%o a092246_list = filter odd a000069_list

%o -- _Reinhard Zumkeller_, Oct 28 2013

%o (Python)

%o def A092246(n): return (n<<2)-(1 if (n-1).bit_count()&1 else 3) # _Chai Wah Wu_, Mar 03 2023

%Y Cf. A129771, A026147.

%Y Cf. A230709 (complement).

%Y Cf. A268717, A268718, A268673.

%K nonn,easy

%O 1,2

%A _Benoit Cloitre_, Feb 23 2004