cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A121885 Excess of n-th prime over previous semiprime.

This page as a plain text file.
%I A121885 #19 Sep 03 2025 00:53:52
%S A121885 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,
%T A121885 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,
%U A121885 7,1,2,2,2,1,3,2,3,2,2,4,4,6,2,6,2,3,3
%N A121885 Excess of n-th prime over previous semiprime.
%C A121885 See: A102415 Greatest semiprime less than n-th prime. See: A102414 Smallest semiprime greater than n-th prime.
%H A121885 T. D. Noe, <a href="/A121885/b121885.txt">Table of n, a(n) for n = 3..10000</a>
%F A121885 a(n) = Min{A000040(n)-s for s < A000040(n) and s in A001358(k)}. a(n) = A000040(n) - A102415(n).
%t A121885 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 *)
%t A121885 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 *)
%o A121885 (PARI) dsemi(n)= { local(k=0); if(isprime(n),k=0;while(bigomega(n-k)<>2&&k<n, k=k+1)); return(k) }
%o A121885 { forprime(n=5,10^3,print1(dsemi(n)", ")) } \\ _Antonio Roldán_, Oct 08 2012
%Y A121885 Cf. A000040, A001358, A062721, A077068, A102414, A102415.
%K A121885 easy,nonn,changed
%O A121885 3,4
%A A121885 _Jonathan Vos Post_, Aug 31 2006
%E A121885 Extended by _T. D. Noe_, Oct 08 2012