login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A211414 Inverse of permutation in A215261. 3

%I #23 Aug 30 2021 12:55:58

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

%T 33,35,37,39,41,43,26,18,24,45,47,36,32,49,51,53,55,57,59,38,61,63,30,

%U 65,34,67,69,71,28,73,42,40,75,77,79,46,81,83,44,85,87

%N Inverse of permutation in A215261.

%C Permutation of the natural numbers A000027 with inverse permutation A215261.

%H Alois P. Heinz, <a href="/A211414/b211414.txt">Table of n, a(n) for n = 1..10000</a>

%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>

%p issp:= n-> not isprime(n) and numtheory[bigomega](n)=2:

%p sp:= proc(n) option remember; local k; if n=1 then 4 else

%p for k from 1+sp(n-1) while not issp(k) do od; k fi end:

%p nsp:= proc(n) option remember; local k; if n=1 then 1 else

%p for k from 1+nsp(n-1) while issp(k) do od; k fi end:

%p g:= proc() true end:

%p b:= proc(n) option remember; local k, s;

%p if n>1 then b(n-1) fi;

%p if irem(n, 2, 'r')=1 then nsp(r+1)

%p else for k do s:=sp(k); if g(s) and not issp(nsp(r)+s) and

%p not issp(nsp(r+1)+s) then g(s):= false; return s fi od

%p fi

%p end:

%p a:= proc() local t, a; t, a:= 0, proc() -1 end;

%p proc(n) local h;

%p while a(n) = -1 do

%p t:= t+1; h:= b(t);

%p if a(h) = -1 then a(h):= t fi

%p od; a(n)

%p end

%p end():

%p seq(a(n), n=1..100);

%t issp[n_] := ! PrimeQ[n] && PrimeOmega[n] == 2;

%t sp[n_] := sp[n] = If[n == 1, 4, For[k = 1+sp[n-1], !issp[k], k++]; k];

%t nsp[n_] := nsp[n] = If[n == 1, 1, For[k = 1+nsp[n-1], issp[k], k++]; k];

%t Clear[g]; g[_] = True;

%t b[n_] := b[n] = Module[{q, r, k, s}, If[n > 1, b[n-1]]; {q, r} = QuotientRemainder[n, 2]; If[r == 1, nsp[q+1], For[k = 1, True, k++, s = sp[k]; If[g[s] && !issp[nsp[q]+s] && !issp[nsp[q+1]+s], g[s] = False; Return[s]]]]];

%t a[n_] := For[k = 1, True, k++, If[b[k] == n, Return[k]]];

%t Table[a[n], {n, 1, 100}] (* _Jean-François Alcover_, Aug 30 2021, after Maple code *)

%Y Cf. A000027, A215261.

%K nonn,easy

%O 1,2

%A _Jonathan Vos Post_ and _Alois P. Heinz_, Feb 18 2013

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 05:49 EDT 2024. Contains 371918 sequences. (Running on oeis4.)