login
a(n) = prime(n+5) - prime(n).
11

%I #21 Sep 08 2022 08:44:50

%S 11,14,14,16,18,18,20,22,20,18,22,22,20,24,24,20,20,22,22,26,28,24,24,

%T 20,16,26,28,30,30,36,24,26,26,28,24,28,24,28,26,24,20,30,32,34,32,34,

%U 28,18,24,28,30,30,30,26,24,20,24,36,34,32,34,38,30,36,36,36,28

%N a(n) = prime(n+5) - prime(n).

%H Reinhard Zumkeller, <a href="/A031167/b031167.txt">Table of n, a(n) for n = 1..10000</a>

%p seq(ithprime(n+5)-ithprime(n), n=1..30);

%t a=5; t=Array[Prime,123]; Drop[t,a]-Drop[t,-a] (* _Vladimir Joseph Stephan Orlovsky_, Aug 13 2009 *)

%t Last[#]-First[#]&/@Partition[Prime[Range[80]],6,1] (* _Harvey P. Dale_, Jul 11 2014 *)

%o (PARI) A031167(n) = prime(n+5)-prime(n)

%o (Magma) [NthPrime(n+5)-NthPrime(n): n in [1..100] ]; // _Vincenzo Librandi_, Apr 23 2011

%o (Haskell)

%o a031167 n = a031167_list !! (n-1)

%o a031167_list = zipWith (-) (drop 5 a000040_list) a000040_list

%o -- _Reinhard Zumkeller_, Aug 23 2015

%Y Cf. A000040, A001223, A031131, A031165, A031166, A031168, A031169, A031170, A031171, A031172.

%K nonn

%O 1,1

%A _Jeff Burch_

%E Initial term added by _Michael B. Porter_, Jan 27 2010