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

 


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A215261 Write down the nonsemiprime numbers 1, 2, 3, 5, 7, 8, 11, 12, 13, 16, 17, ... and insert between two nonsemiprimes the smallest semiprime not yet present in the sequence such that two neighboring integers sum to a nonsemiprime. 2

%I #45 Aug 30 2021 12:53:28

%S 1,6,2,9,3,14,5,22,7,4,8,21,11,25,12,15,13,34,16,26,17,10,18,35,19,33,

%T 20,55,23,49,24,39,27,51,28,38,29,46,30,58,31,57,32,65,36,62,37,77,40,

%U 69,41,85,42,74,43,82,44,86,45,91,47,106,48,87,50,115,52

%N Write down the nonsemiprime numbers 1, 2, 3, 5, 7, 8, 11, 12, 13, 16, 17, ... and insert between two nonsemiprimes the smallest semiprime not yet present in the sequence such that two neighboring integers sum to a nonsemiprime.

%C This is to semiprimes A001358 as A222307 is to primes A000040.

%C This is a permutation of the natural numbers A000027 with inverse permutation A211414.

%H Alois P. Heinz, <a href="/A215261/b215261.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 a:= proc(n) option remember; local k, s;

%p if n>1 then a(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 seq(a(n), n=1..80);

%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 a[n_] := a[n] = Module[{q, r, k, s}, If[n>1, a[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 Table[a[n], {n, 1, 80}] (* _Jean-François Alcover_, Mar 24 2017, translated from Maple *)

%Y Cf. A001358, A211414, A222307.

%K nonn,easy

%O 1,2

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

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | 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 September 18 23:03 EDT 2024. Contains 376002 sequences. (Running on oeis4.)