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.

A059790 Distance between 2*(n-th prime) and nearest prime.

This page as a plain text file.
%I A059790 #11 Feb 08 2025 04:51:11
%S A059790 1,1,1,1,1,3,3,1,1,1,1,1,1,3,3,1,5,5,3,3,3,1,1,1,1,3,5,3,5,1,3,1,3,1,
%T A059790 5,5,1,5,3,1,1,3,1,3,3,1,1,3,3,1,1,1,3,1,5,3,3,1,3,1,3,1,1,3,5,3,1,1,
%U A059790 3,3,3,1,1,3,1,3,5,3,5,3,1,3,1,3,1,1,9,3,3,3,3,5,3,1,1,3,1,3,3,5,1,3,3,9,9
%N A059790 Distance between 2*(n-th prime) and nearest prime.
%H A059790 Amiram Eldar, <a href="/A059790/b059790.txt">Table of n, a(n) for n = 1..10000</a>
%e A059790 Distance 1 means that either 2p+1 or 2p-1 is also prime.
%p A059790 with(numtheory): [seq(min(2*ithprime(k)-prevprime(2*ithprime(k)), nextprime(2*ithprime(k))-2*ithprime(k)),k=1..256)];
%t A059790 a[n_] := Min@ Differences[{NextPrime[#, -1], #, NextPrime[#]} & @ (2*Prime[n])]; Array[a, 100]  (* _Amiram Eldar_, Feb 08 2025 *)
%o A059790 (PARI) a(n) = {my(m = 2*prime(n)); min(m - precprime(m-1), nextprime(m+1) - m);} \\ _Amiram Eldar_, Feb 08 2025
%Y A059790 Cf. A005382, A005383, A005384, A005385.
%K A059790 nonn
%O A059790 1,6
%A A059790 _Labos Elemer_, Feb 22 2001
%E A059790 Offset corrected by _Amiram Eldar_, Feb 08 2025