%I #23 Jun 07 2024 10:49:40
%S 1,2,3,5,7,4,8,6,9,10,11,13,15,17,19,23,25,14,16,21,27,12,18,20,22,26,
%T 28,24,29,30,31,32,33,34,36,37,39,35,41,38,40,43,44,47,49,53,55,51,57,
%U 45,59,61,63,65,67,71,73,42,46,77,79,48,50,69,75,52,56
%N Lexicographically earliest sequence of distinct positive terms such that for any n > 0, a(n) is coprime to a(2*n) and to a(2*n+1).
%C This sequence has connections with A082746: here a(n) is coprime to a(2*n) and to a(2*n+1), there a(n) is coprime to a(2*n).
%C This sequence is a permutation of the natural numbers (with inverse A291604 and fixed points A291610):
%C - the sequence can always be extended with a prime number,
%C - all prime numbers appear in the sequence, in increasing order,
%C - for any n, there are infinitely many prime numbers coprime to n, so eventually n will appear in the sequence.
%H Rémy Sigrist, <a href="/A291603/b291603.txt">Table of n, a(n) for n = 1..10000</a>
%H Michael De Vlieger, <a href="/A291603/a291603_1.png">Log log scatterplot of a(n)</a>, n = 1..2^12, showing records in red and local minima in blue, highlighting primes in green and other prime powers in gold.
%H Rémy Sigrist, <a href="/A291603/a291603.png">Scatterplot of the first 10000 terms</a>
%H Rémy Sigrist, <a href="/A291603/a291603.gp.txt">PARI program for A291603</a>
%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%e a(1) = 1 is suitable.
%e a(2) must be coprime to a(1) = 1.
%e a(2) = 2 is suitable.
%e a(3) must be coprime to a(1) = 1.
%e a(3) = 3 is suitable.
%e a(4) must be coprime to a(2) = 2.
%e a(4) = 5 is suitable.
%e a(5) must be coprime to a(2) = 2.
%e a(5) = 7 is suitable.
%e a(6) must be coprime to a(3) = 3.
%e a(6) = 4 is suitable.
%e a(7) must be coprime to a(3) = 3.
%e a(7) = 8 is suitable.
%e a(8) must be coprime to a(4) = 5.
%e a(8) = 6 is suitable.
%e a(9) must be coprime to a(4) = 5.
%e a(9) = 9 is suitable.
%e a(10) must be coprime to a(5) = 7.
%e a(10) = 10 is suitable.
%t nn = 67; c[_] = False; Set[{a[1], c[1]}, {1, True}]; u = 2; Do[Set[{j, k}, {a[Floor[n/2]], u}]; While[Nand[! c[k], CoprimeQ[j, k]], k++]; Set[{a[n], c[k]}, {k, True}]; If[k == u, While[c[u], u++]], {n, 2, nn}]; Array[a, nn] (* _Michael De Vlieger_, Oct 28 2022 *)
%o (PARI) \\ See Links section.
%Y Cf. A082746, A291604 (inverse), A291610 (fixed points).
%K nonn,look
%O 1,2
%A _Rémy Sigrist_, Aug 27 2017