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
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, 33, 35, 37, 39, 41, 43, 26, 18, 24, 45, 47, 36, 32, 49, 51, 53, 55, 57, 59, 38, 61, 63, 30, 65, 34, 67, 69, 71, 28, 73, 42, 40, 75, 77, 79, 46, 81, 83, 44, 85, 87 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
Permutation of the natural numbers A000027 with inverse permutation A215261.
LINKS
MAPLE
issp:= n-> not isprime(n) and numtheory[bigomega](n)=2:
sp:= proc(n) option remember; local k; if n=1 then 4 else
for k from 1+sp(n-1) while not issp(k) do od; k fi end:
nsp:= proc(n) option remember; local k; if n=1 then 1 else
for k from 1+nsp(n-1) while issp(k) do od; k fi end:
g:= proc() true end:
b:= proc(n) option remember; local k, s;
if n>1 then b(n-1) fi;
if irem(n, 2, 'r')=1 then nsp(r+1)
else for k do s:=sp(k); if g(s) and not issp(nsp(r)+s) and
not issp(nsp(r+1)+s) then g(s):= false; return s fi od
fi
end:
a:= proc() local t, a; t, a:= 0, proc() -1 end;
proc(n) local h;
while a(n) = -1 do
t:= t+1; h:= b(t);
if a(h) = -1 then a(h):= t fi
od; a(n)
end
end():
seq(a(n), n=1..100);
MATHEMATICA
issp[n_] := ! PrimeQ[n] && PrimeOmega[n] == 2;
sp[n_] := sp[n] = If[n == 1, 4, For[k = 1+sp[n-1], !issp[k], k++]; k];
nsp[n_] := nsp[n] = If[n == 1, 1, For[k = 1+nsp[n-1], issp[k], k++]; k];
Clear[g]; g[_] = True;
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]]]]];
a[n_] := For[k = 1, True, k++, If[b[k] == n, Return[k]]];
Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Aug 30 2021, after Maple code *)
CROSSREFS
Sequence in context: A188983 A083519 A302088 * A173706 A365440 A332359
KEYWORD
nonn,easy
AUTHOR
STATUS
approved

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 March 4 23:31 EST 2024. Contains 370537 sequences. (Running on oeis4.)