login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo

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 56th year, we are closing in on 350,000 sequences, and we’ve crossed 9,700 citations (which often say “discovered thanks to the OEIS”).

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

Alois P. Heinz, Table of n, a(n) for n = 1..10000

Index entries for sequences that are permutations of the natural numbers

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

Cf. A000027, A215261.

Sequence in context: A188983 A083519 A302088 * A173706 A332359 A328070

Adjacent sequences:  A211411 A211412 A211413 * A211415 A211416 A211417

KEYWORD

nonn,easy

AUTHOR

Jonathan Vos Post and Alois P. Heinz, Feb 18 2013

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified November 30 21:20 EST 2021. Contains 349426 sequences. (Running on oeis4.)