login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A369800 Lexicographically earliest sequence of distinct positive integers such that the parity of the successive bits of the concatenated binary expansions of the terms is equal to the parity of the terms. 0
1, 3, 5, 7, 2, 9, 11, 13, 15, 17, 4, 19, 6, 8, 21, 23, 10, 25, 27, 29, 31, 12, 33, 35, 37, 39, 41, 43, 14, 16, 18, 45, 47, 20, 22, 49, 24, 26, 51, 53, 55, 57, 28, 59, 30, 32, 34, 61, 36, 63, 38, 65, 67, 40, 69, 71, 73, 75, 42, 77, 44, 79, 81, 46, 48, 83, 85, 87, 50, 89, 91, 93, 95 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
The concatenated binary expansions of the terms act as instructions to take the next unused odd or even number.
This is a permutation of the positive integers.
LINKS
EXAMPLE
terms 1 3 5 7 2 9
binary {1}, {1, 1}, {1, 0, 1}, {1, 1, 1}, {1, 0}, {1, 0, 0, 1}
terms 1, 3, 5, 7, 2, 9, 11,13,15, 17, 4, 19, 6, 8,21
n = 1 2 3 4 5 6 7 8 9 10 11 ...
a(11) = 4 because the 11th bit in the binary expansions is 0 (from term a(5)=2 as it happens) which means a(11) must be even and 4 is the least even positive integer not yet in the sequence.
MATHEMATICA
a[1]=1; a[n_]:=a[n]=(k=1; While[MemberQ[Array[a, n-1], k]||Boole@OddQ@k!= Flatten[IntegerDigits[Join[Array[a, n-1], {k}], 2]][[n]], k++]; k); Array[a, 73]
PROG
(Python)
from itertools import count, islice
def agen(): # generator of terms
an, parity, nextk = 1, [None, 1, 1, 1], [2, 5]
yield from [1, 3]
for n in count(3):
an = nextk[parity[n]]
yield an
nextk[parity[n]] = nextk[parity[n]] + 2
parity.extend(map(int, bin(an)[2:]))
print(list(islice(agen(), 73))) # Michael S. Branicky, Feb 01 2024
CROSSREFS
Cf. A030190.
Sequence in context: A263792 A263411 A352950 * A367291 A367289 A351463
KEYWORD
nonn,base
AUTHOR
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 4 22:02 EDT 2024. Contains 375685 sequences. (Running on oeis4.)