login
Inverse permutation to sequence A117532 (if indeed sequence A117532 is a permutation of the positive integers).
3

%I #18 Nov 20 2024 08:14:56

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

%T 26,31,27,29,33,30,37,32,34,35,40,36,38,43,39,41,45,42,49,44,46,47,52,

%U 48,50,55,51,53,57,54,61,56,58,59,62,63,65,60,69,64,66,67,73,68,70,71

%N Inverse permutation to sequence A117532 (if indeed sequence A117532 is a permutation of the positive integers).

%H Jean-François Alcover, <a href="/A117534/b117534.txt">Table of n, a(n) for n = 1..3000</a>

%p read("transforms") ; A117532 := proc(nmax) local a, n,nxt, asu ; a := [1] ; asu := 1 ; while nops(a) < nmax do n := nops(a)+1 ; nxt := 1 ; while nxt in a or gcd(n, asu+nxt) <> 1 do nxt := nxt+1 ; od ; a := [op(a), nxt] ; asu := asu+nxt ; od ; a ; end: A117532(180) ; INVERSE(%) ; # _R. J. Mathar_, Jul 20 2009

%t (* b(n) is A117532 *)

%t nmaxa = 72; nmaxb = nmaxa + 3;

%t (* nmaxb can be increased in case less than nmaxa terms are produced *)

%t b[n_] := b[n] = If[n == 1, 1, bb = Array[b, n-1]; For[k = 2, True, k++, If[FreeQ[bb, k] && CoprimeQ[n, Total[bb]+k], Return[k]]]];

%t Do[a[b[n]] = n, {n, 1, nmaxb}];

%t TakeWhile[Table[a[n], {n, 1, nmaxa}], IntegerQ] (* _Jean-François Alcover_, Nov 18 2024 *)

%Y Cf. A117532, A117533.

%K nonn

%O 1,2

%A _Leroy Quet_, Mar 26 2006

%E More terms from _R. J. Mathar_, Jul 20 2009