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!)
A115766 Distance from the n-th prime to the nearest semiprime. 2
2, 1, 1, 1, 1, 1, 2, 2, 1, 3, 2, 1, 2, 3, 1, 2, 1, 1, 2, 2, 1, 2, 1, 2, 2, 5, 3, 1, 2, 2, 2, 2, 3, 2, 3, 4, 1, 2, 1, 4, 1, 2, 3, 1, 3, 2, 2, 2, 1, 3, 2, 2, 4, 2, 2, 1, 2, 3, 1, 3, 4, 2, 2, 2, 1, 2, 2, 2, 1, 3, 2, 1, 2, 2, 2, 1, 2, 1, 2, 2, 2, 1, 4, 4, 2, 2, 2 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
This is a very slow-growing function. For the first 10^8 primes, the largest value is 45, which occurs for the prime 981270947.
LINKS
EXAMPLE
a(10)=3 because 29 is the 10th prime and the nearest semiprime is 26.
MATHEMATICA
SemiPrimeQ[n_] := (2==Plus@@(Transpose[FactorInteger[n]][[2]])); Join[{2}, Table[p=Prime[i]; j=1; While[ !SemiPrimeQ[p+j] && !SemiPrimeQ[p-j], j++ ]; j, {i, 2, 150}]]
dnsm[n_]:=Module[{k=1}, While[PrimeOmega[n-k]!=2&&PrimeOmega[n+k]!=2, k++]; k]; dnsm/@Prime[Range[90]] (* Harvey P. Dale, May 04 2019 *)
CROSSREFS
Cf. A001358 (semiprimes).
Sequence in context: A279794 A025900 A118383 * A108339 A138559 A073454
KEYWORD
easy,nonn
AUTHOR
T. D. Noe, Jan 30 2006
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 April 24 02:28 EDT 2024. Contains 371917 sequences. (Running on oeis4.)