cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A222209 Inverse of permutation in A222208.

This page as a plain text file.
%I A222209 #15 Feb 22 2018 11:11:33
%S A222209 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,
%T A222209 26,25,59,28,61,27,38,67,49,12,71,73,46,35,79,33,83,57,89,97,101,18,
%U A222209 103,51,62,69,107,16,109,55,74,113,127,34,131,137,121,45,139
%N A222209 Inverse of permutation in A222208.
%C A222209 Permutation of the natural numbers A000027 with inverse permutation A222208.
%H A222209 Alois P. Heinz, <a href="/A222209/b222209.txt">Table of n, a(n) for n = 1..10000</a>
%H A222209 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%p A222209 b:= proc(n) false end:
%p A222209 g:= proc(n) option remember; local h, i;
%p A222209       if n<3 then h:= 2*n-1 else g(n-1); h:= ilcm(map(g,
%p A222209          numtheory[divisors](n) minus {1, n})[]) fi;
%p A222209       for i while b(i*h) do od;
%p A222209       b(i*h):= true; i*h
%p A222209     end:
%p A222209 a:= proc() local t, a; t, a:= -1, proc() -1 end;
%p A222209       proc(n) local h;
%p A222209         while a(n) = -1 do
%p A222209           t:= t+1; h:= g(t);
%p A222209           if a(h) = -1 then a(h):= t fi
%p A222209         od; a(n)
%p A222209       end
%p A222209     end():
%p A222209 seq(a(n), n=1..100);
%t A222209 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 *)
%o A222209 (Haskell)
%o A222209 import Data.List (elemIndex)
%o A222209 import Data.Maybe (fromJust)
%o A222209 a222209 = (+ 1) . fromJust . (`elemIndex` a222208_list)
%o A222209 -- _Reinhard Zumkeller_, Feb 13 2013
%Y A222209 Cf. A000027, A211384, A222208.
%K A222209 nonn,look
%O A222209 1,2
%A A222209 _Alois P. Heinz_, Feb 12 2013