A079523 Utterly odd numbers: numbers whose binary representation ends in an odd number of ones.
1, 5, 7, 9, 13, 17, 21, 23, 25, 29, 31, 33, 37, 39, 41, 45, 49, 53, 55, 57, 61, 65, 69, 71, 73, 77, 81, 85, 87, 89, 93, 95, 97, 101, 103, 105, 109, 113, 117, 119, 121, 125, 127, 129, 133, 135, 137, 141, 145, 149, 151, 153, 157, 159, 161, 165, 167, 169, 173, 177, 181
Offset: 1
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
- J.-P. Allouche, Thue, Combinatorics on words, and conjectures inspired by the Thue-Morse sequence, arXiv preprint arXiv:1401.3727 [math.NT], 2014.
- J.-P. Allouche, Thue, Combinatorics on words, and conjectures inspired by the Thue-Morse sequence, J. de Théorie des Nombres de Bordeaux, 27, no. 2 (2015), 375-388.
- J.-P. Allouche, A. Arnold, J. Berstel, S. Brlek, W. Jockusch, Simon Plouffe, and B. E. Sagan, A relative of the Thue-Morse sequence, Discrete Math., 139, 1995, 455-461.
- Narad Rampersad and Manon Stipulanti, The Formal Inverse of the Period-Doubling Sequence, arXiv:1807.11899 [math.CO], 2018.
- Thomas Zaslavsky, Anti-Fibonacci Numbers: A Formula, Sep 26 2016 [Introduces the name "utterly odd". - _N. J. A. Sloane_, Sep 27 2016]
- Index entries for 2-automatic sequences.
Programs
-
Haskell
import Data.List (elemIndices) a079523 n = a079523_list !! (n-1) a079523_list = elemIndices 0 a035263_list -- Reinhard Zumkeller, Mar 01 2012
-
Magma
[n: n in [0..200] | Valuation(n+1, 2) mod 2 eq 0 + 1]; // Vincenzo Librandi, Apr 16 2015
-
Mathematica
Select[ Range[200], MatchQ[ IntegerDigits[#, 2], {b : (1) ..} | {_, 0, b : (1) ..} /; OddQ[ Length[{b}]]] & ] (* Jean-François Alcover, Jun 17 2013 *)
-
PARI
is(n)=valuation(n+1,2)%2 \\ Charles R Greathouse IV, Mar 07 2013
-
Python
from itertools import count, islice def A079523_gen(startvalue=1): return filter(lambda n:(~(n+1)&n).bit_length()&1,count(max(startvalue,1))) # generator of terms >= startvalue A079523_list = list(islice(A079523_gen(),30)) # Chai Wah Wu, Jul 05 2022
-
Python
def A079523(n): def bisection(f,kmin=0,kmax=1): while f(kmax) > kmax: kmax <<= 1 kmin = kmax >> 1 while kmax-kmin > 1: kmid = kmax+kmin>>1 if f(kmid) <= kmid: kmax = kmid else: kmin = kmid return kmax def f(x): c, s = n+x, bin(x)[2:] l = len(s) for i in range(l&1,l,2): c -= int(s[i])+int('0'+s[:i],2) return c return bisection(f,n,n)-1 # Chai Wah Wu, Jan 29 2025
Formula
a(n) is asymptotic to 3n.
a(n) = 2*A003159(n) - 1. a(1)=1, a(n) = a(n-1) + 2 if (a(n-1)+1)/2 does not belong to the sequence and a(n) = a(n-1) + 4 otherwise. - Emeric Deutsch and Bruce E. Sagan, Apr 02 2003
a(n) = (1/2)*A081706(2n-1).
Values of k such that A091297(k) = 0. - Philippe Deléham, Feb 25 2004
Comments