A121885 Excess of n-th prime over previous semiprime.
1, 1, 1, 3, 2, 4, 1, 3, 5, 2, 2, 4, 1, 2, 1, 3, 2, 2, 4, 2, 1, 2, 2, 6, 8, 1, 3, 2, 4, 2, 3, 5, 3, 5, 2, 2, 1, 4, 1, 3, 4, 6, 3, 5, 2, 2, 1, 3, 7, 2, 4, 2, 3, 1, 2, 4, 3, 3, 5, 2, 2, 2, 4, 3, 2, 2, 1, 3, 7, 1, 2, 2, 2, 1, 3, 2, 3, 2, 2, 4, 4, 6, 2, 6, 2, 3, 3
Offset: 3
Links
- T. D. Noe, Table of n, a(n) for n = 3..10000
Programs
-
Mathematica
SemiPrimeQ[n_Integer] := If[Abs[n] < 2, False, (2 == Plus @@ Transpose[FactorInteger[Abs[n]]][[2]])]; Table[i = Prime[n] - 1; While[! SemiPrimeQ[i], i--]; Prime[n] - i, {n, 3, 100}] (* T. D. Noe, Oct 08 2012 *) eps[n_]:=Module[{c=n-1},While[PrimeOmega[c]!=2,c--];n-c]; Table[eps[n],{n,Prime[Range[3,90]]}] (* Harvey P. Dale, Aug 12 2014 *)
-
PARI
dsemi(n)= { local(k=0); if(isprime(n),k=0;while(bigomega(n-k)<>2&&k
Antonio Roldán, Oct 08 2012
Formula
Extensions
Extended by T. D. Noe, Oct 08 2012
Comments