login
Inverse permutation to A175500.
1

%I #15 May 23 2016 17:10:39

%S 1,2,3,4,5,6,7,9,10,11,14,8,16,12,18,13,20,19,22,24,28,33,35,15,25,37,

%T 39,26,41,27,43,30,45,47,49,17,51,53,62,29,55,57,64,31,66,84,82,21,58,

%U 70,88,74,86,59,90,60,94,96,92,23,98,102,76,32,112,68

%N Inverse permutation to A175500.

%H Max Barrentine, <a href="/A272570/b272570.txt">Table of n, a(n) for n = 1..693</a>

%t p = Last /@ Import["https://oeis.org/A175500/b175500.txt", "Table"]; n = First[ Complement[ Range[10^4], p]] - 1; ip = 0 Range@ n; Do[If[(v = p[[i]]) <= n, ip[[v]] = i], {i, Length@p}]; ip (* _Giovanni Resta_, May 21 2016 *)

%o (PARI) ok(j, va, vs, n) = {if (vecsearch(vs, j), return (0)); for (k=1, n-1, if ((numdiv(j) == numdiv(va[k])) && (numdiv(va[k-1]) == numdiv(va[n-1])), return (0));); 1;}

%o findnew(va, vs, n) = {my(j = 1); my(vs = vecsort(va)); until (ok(j, va, vs, n), j++); j;}

%o listb(nn) = {my(va = [1]); for (n=2, nn, vs = vecsort(va); newa = findnew(va, vs, n); va = concat(va, newa);); va;}

%o invp(v) = {for (i=1, vecmax(v), found = 0; for (k=1, #v, if (v[k] == i, found = k; break);); if (! found, break); print1(found, ", "););}

%o lista(nn) = invp(listb(nn)); \\ _Michel Marcus_, May 04 2016

%Y Cf. A175500.

%K nonn

%O 1,2

%A _Max Barrentine_, May 03 2016