

A263792


"Shuffled bisection" of positive even and odd numbers, Type 2 (see "Comments" for rules generating the sequence).


2



1, 3, 5, 7, 2, 9, 11, 13, 4, 15, 17, 19, 6, 8, 21, 23, 10, 12, 25, 14, 27, 29, 31, 16, 33, 18, 35, 37, 20, 39, 41, 43, 22, 45, 47, 24, 49, 26, 51, 53, 28, 55, 30, 32, 57, 59, 61, 34, 63, 36, 65, 67, 38, 69, 71, 73, 40, 42, 44, 75, 46, 77, 79, 48, 50
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


COMMENTS

All terms are positive, with even and odd terms appearing in due course in order. One might think of the sequence as the result of two poorlyshuffled decks of cards with numbers in increasing order  one deck with all the positive even numbers and one with all the positive odd numbers, following this set of rules:
Start with a(1)=1; take next odd number until preceding an odd composite, then take next even number. Take next odd unless coprime to last term, otherwise take next even. Repeat indefinitely.
Odd terms precede primes (by definition); primes are followed by even terms unless smallest twin prime.
Excluding a(1)..a(4), the maximum length of odd strings is 3. Is there a limit to the maximum length of even strings?
Same as A263411(n), n<=25.
If seeds are a(1)=1 and a(2)=2, the sequences converge after a(17).


LINKS

Michael De Vlieger, Table of n, a(n) for n = 1..10000


EXAMPLE

a(11)=17; since next odd is prime, take a(12)=19. Since next odd is composite, take next even, so a(13)=6. Since next odd (21) is not coprime to 6, take a(14)=8. Since 21 is coprime to 8, take a(15)=21.


MATHEMATICA

f[n_] := Block[{a = 3, b = 2, t = {1}, k}, Do[Which[And[OddQ@ t[[k  1]], PrimeQ@ a], AppendTo[t, a]; a += 2, And[OddQ@ t[[k  1]], CompositeQ@ a], AppendTo[t, b]; b += 2, And[EvenQ@ t[[k  1]], CoprimeQ[a, t[[k  1]]]], AppendTo[t, a]; a += 2, And[EvenQ@ t[[k  1]], ! CoprimeQ[a, t[[k  1]]]], AppendTo[t, b]; b += 2, True, AppendTo[t, 1]], {k, 2, n}]; t]; f@ 120 (* Michael De Vlieger, Oct 27 2015 *)


CROSSREFS

Cf. A005408, A005843, A263411.
Sequence in context: A271833 A104260 A334355 * A263411 A121573 A196407
Adjacent sequences: A263789 A263790 A263791 * A263793 A263794 A263795


KEYWORD

nonn


AUTHOR

Bob Selcoe, Oct 26 2015


STATUS

approved



