login
a(n) is the largest m such that there is no prime except prime(n) from prime(n)-m+1 to prime(n)+m.
1

%I #20 Oct 29 2024 12:22:56

%S 0,1,1,2,1,2,1,2,4,1,2,3,1,2,4,5,1,2,3,1,2,3,4,6,3,1,2,1,2,4,3,4,1,2,

%T 1,2,5,3,4,5,1,2,1,2,1,2,11,3,1,2,4,1,2,5,5,5,1,2,3,1,2,10,3,1,2,4,5,

%U 6,1,2,4,6,5,5,3,4,6,3,4,8,1,2,1,2,3,4,6,3,1,2,4,7

%N a(n) is the largest m such that there is no prime except prime(n) from prime(n)-m+1 to prime(n)+m.

%C For a prime p, the degree of insulation is formally defined as D(p) = Max_{m=1..oo} U where the set U = {m: A000720(p+m) - A000720(p-m) = 1}.

%C This sequence is employed in defining insulated primes and highly insulated primes.

%H Robert Israel, <a href="/A339270/b339270.txt">Table of n, a(n) for n = 1..10000</a>

%H Abhimanyu Kumar and Anuraag Saxena, <a href="https://arxiv.org/abs/2011.14210">Insulated primes</a>, arXiv:2011.14210 [math.NT], 2020. See also <a href="https://doi.org/10.7546/nntdm.2024.30.3.602-612">Notes Num. Theor. Disc. Math.</a> (2024) Vol. 30, No. 3, 602-612.

%p f:= p -> min(nextprime(p)-p-1, p-prevprime(p)): f(2):= 0:

%p map(f@ithprime, [$1..100]); # _Robert Israel_, Dec 24 2020

%t {0}~Join~Array[Min[NextPrime[# + 1] - # - 1, # - NextPrime[# - 1, -1]] &@ Prime@ # &, 91, 2] (* _Michael De Vlieger_, Dec 11 2020 *)

%o (PARI)

%o D(p)={min(nextprime(p+1)-p-1, p-precprime(p-1))}

%o forprime(p=2, 1000, print1(D(p), ", "))

%Y Cf. A000040, A000720, A339148 (insulated primes), A339188 (highly insulated primes).

%Y Related sequences: A046929.

%K nonn,changed

%O 1,4

%A _Abhimanyu Kumar_, Nov 29 2020