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!)
A104202 Differences of straddle primes. 0

%I #11 Sep 29 2015 10:22:48

%S 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,

%T 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,

%U 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

%N Differences of straddle primes.

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

%e 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.

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

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

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

%K easy,nonn

%O 4,1

%A _Cino Hilliard_, Mar 13 2005

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 23 12:44 EDT 2024. Contains 371913 sequences. (Running on oeis4.)