login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A222209
Inverse of permutation in A222208.
5
1, 3, 2, 5, 7, 4, 11, 9, 13, 17, 19, 6, 23, 29, 14, 15, 31, 8, 37, 21, 22, 41, 43, 10, 47, 53, 26, 25, 59, 28, 61, 27, 38, 67, 49, 12, 71, 73, 46, 35, 79, 33, 83, 57, 89, 97, 101, 18, 103, 51, 62, 69, 107, 16, 109, 55, 74, 113, 127, 34, 131, 137, 121, 45, 139
OFFSET
1,2
COMMENTS
Permutation of the natural numbers A000027 with inverse permutation A222208.
MAPLE
b:= proc(n) false end:
g:= proc(n) option remember; local h, i;
if n<3 then h:= 2*n-1 else g(n-1); h:= ilcm(map(g,
numtheory[divisors](n) minus {1, n})[]) fi;
for i while b(i*h) do od;
b(i*h):= true; i*h
end:
a:= proc() local t, a; t, a:= -1, proc() -1 end;
proc(n) local h;
while a(n) = -1 do
t:= t+1; h:= g(t);
if a(h) = -1 then a(h):= t fi
od; a(n)
end
end():
seq(a(n), n=1..100);
MATHEMATICA
terms = 100; b[1] = 1; b[2] = 3; b[n_] := b[n] = Module[{d, s, c, k}, d = Divisors[n] ~Complement~ {1, n}; For[s = Sort[Array[b, n - 1]]; c = Complement[ Range[ Last[s]], s]; k = If[c == {}, Last[s] + 1, First[c]], True, k++, If[FreeQ[s, k], If[AllTrue[d, Divisible[k, b[#]] &], Return[k]]]]]; a[n_] := a[n] = For[k = 1, True, k++, If[b[k] == n, Return[k]]]; Array[a, terms] (* Jean-François Alcover, Feb 22 2018 *)
PROG
(Haskell)
import Data.List (elemIndex)
import Data.Maybe (fromJust)
a222209 = (+ 1) . fromJust . (`elemIndex` a222208_list)
-- Reinhard Zumkeller, Feb 13 2013
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Alois P. Heinz, Feb 12 2013
STATUS
approved