login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A104202 Differences of straddle primes. 0
2, 2, 4, 4, 4, 2, 4, 4, 4, 2, 4, 4, 4, 6, 6, 6, 6, 6, 2, 6, 6, 6, 6, 6, 4, 4, 4, 2, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 2, 6, 6, 6, 6, 6, 4, 4, 4, 2, 6, 6, 6, 6, 6, 4, 4, 4, 6, 6, 6, 6, 6, 8, 8, 8, 8, 8, 8, 8, 4, 4, 4, 2, 4, 4, 4, 2, 4, 4, 4, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 4, 4, 4, 6 (list; graph; refs; listen; history; text; internal format)
OFFSET

4,1

LINKS

Table of n, a(n) for n=4..102.

FORMULA

Straddle primes are the nearest primes preceding and following composite n.

EXAMPLE

The first straddle prime pair is 3 and 5 which straddles the composite number 4 and 5-3 = 2 the first entry in the table.

MATHEMATICA

NextPrime[#]-NextPrime[#, -1]&/@Rest[Select[Range[200], !PrimeQ[#]&]] (* Harvey P. Dale, Aug 23 2012 *)

PROG

(PARI) straddiff(n) = { local (x, y, pp, np); for(x=1, n, y=composite(x); pp=precprime(y); np=nextprime(y); print1(np-pp", ") )

composite(n) = { local(c, x); c=1; x=1; while(c <= n, x++; if(!isprime(x), c++); ); return(x) } }

CROSSREFS

Sequence in context: A143729 A006460 A064137 * A042946 A037202 A227091

Adjacent sequences:  A104199 A104200 A104201 * A104203 A104204 A104205

KEYWORD

easy,nonn

AUTHOR

Cino Hilliard, Mar 13 2005

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 May 23 07:54 EDT 2019. Contains 323508 sequences. (Running on oeis4.)