login
Rearrangement of natural numbers disturbing the position of every number such that a(n) is coprime to a(m) if n is coprime to m. (a(n),a(m)) = 1 if (n,m) = 1.
0

%I #6 Jan 01 2024 13:20:36

%S 2,1,5,3,7,9,11,13,17,19,23,15,29,27,25,31,37,39,41,21,43,47,53,45,49,

%T 57,59,33,61,35,67,71,73,79,77,51,83,81,85,63,89,55,97,69,101,93,103,

%U 65,107,91,109,87,113,75,127,99,125,117,131,95,137,139,121,141,133,115,149

%N Rearrangement of natural numbers disturbing the position of every number such that a(n) is coprime to a(m) if n is coprime to m. (a(n),a(m)) = 1 if (n,m) = 1.

%o (PARI) A = vector(100); used = vector(5000); A[1] = 2; A[2] = 1; for (n = 3, 100, found = 0; k = 1; while(!found, k = k + 2; if (!used[k] && k != n, m = 3; works = 1; while (works && m < n, if (gcd(m, n) == 1 && gcd(A[m], k) > 1, works = 0, m = m + 1)); found = works)); A[n] = k; used[k] = 1); A

%K nonn

%O 1,1

%A _Amarnath Murthy_, Apr 16 2003

%E Corrected and extended by _David Wasserman_, Sep 30 2004