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.

A341827 a(n) is the distance from n to its more distant neighboring prime.

This page as a plain text file.
%I A341827 #14 Mar 18 2021 05:47:04
%S A341827 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,
%T A341827 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,
%U A341827 4,1,6,5,4,3,4,5,6,3,2,3,6,5,4,3,4,5,8
%N A341827 a(n) is the distance from n to its more distant neighboring prime.
%C A341827 a(n) is even if n is odd and vice versa. It seems that all records are even.
%C A341827 n - 1 and n + 1 are twin primes if a(n) = 1.
%C A341827 n - 2 and n + 2 are cousin primes for n > 3 if a(n) = 2.
%C A341827 n - 3 and n + 3 are sexy primes if a(n) = A051700(n) = 3.
%F A341827 a(n) = max{n - prevprime(n), nextprime(n) - n}.
%t A341827 Array[Max[#1 - #2, #3 - #1] & @@ Prepend[NextPrime[#, {-1, 1}], #] &, 105, 3] (* _Michael De Vlieger_, Mar 17 2021 *)
%o A341827 (Python)
%o A341827 from sympy import prevprime, nextprime
%o A341827 for n in range(3, 1001):
%o A341827     prevp = prevprime(n); nextp = nextprime(n)
%o A341827     print(max(n - prevp, nextp - n))
%o A341827 (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
%Y A341827 Cf. A051700, A051698, A077800, A023200, A046132, A023201, A046117.
%K A341827 nonn
%O A341827 3,1
%A A341827 _Ya-Ping Lu_, Feb 20 2021