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!)
A341827 a(n) is the distance from n to its more distant neighboring prime. 0
2, 1, 2, 1, 4, 3, 2, 3, 4, 1, 4, 3, 2, 3, 4, 1, 4, 3, 2, 3, 6, 5, 4, 3, 4, 5, 6, 1, 6, 5, 4, 3, 4, 5, 6, 3, 2, 3, 4, 1, 4, 3, 2, 3, 6, 5, 4, 3, 4, 5, 6, 5, 4, 3, 4, 5, 6, 1, 6, 5, 4, 3, 4, 5, 6, 3, 2, 3, 4, 1, 6, 5, 4, 3, 4, 5, 6, 3, 2, 3, 6, 5, 4, 3, 4, 5, 8 (list; graph; refs; listen; history; text; internal format)
OFFSET

3,1

COMMENTS

a(n) is even if n is odd and vice versa. It seems that all records are even.

n - 1 and n + 1 are twin primes if a(n) = 1.

n - 2 and n + 2 are cousin primes for n > 3 if a(n) = 2.

n - 3 and n + 3 are sexy primes if a(n) = A051700(n) = 3.

LINKS

Table of n, a(n) for n=3..89.

FORMULA

a(n) = max{n - prevprime(n), nextprime(n) - n}.

MATHEMATICA

Array[Max[#1 - #2, #3 - #1] & @@ Prepend[NextPrime[#, {-1, 1}], #] &, 105, 3] (* Michael De Vlieger, Mar 17 2021 *)

PROG

(Python)

from sympy import prevprime, nextprime

for n in range(3, 1001):

    prevp = prevprime(n); nextp = nextprime(n)

    print(max(n - prevp, nextp - n))

(PARI) for(n=3, 88, my(d1=n-precprime(n-1), d2=nextprime(n+1)-n); print1(max(d1, d2), ", ")) \\ Hugo Pfoertner, Mar 10 2021

CROSSREFS

Cf. A051700, A051698, A077800, A023200, A046132, A023201, A046117.

Sequence in context: A159272 A098372 A177236 * A138567 A103530 A090924

Adjacent sequences:  A341824 A341825 A341826 * A341828 A341829 A341830

KEYWORD

nonn

AUTHOR

Ya-Ping Lu, Feb 20 2021

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 June 28 07:25 EDT 2022. Contains 354903 sequences. (Running on oeis4.)