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

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

%S 9,10,12,12,12,16,14,18,18,14,16,16,18,18,20,18,14,18,16,18,24,22,20,

%T 18,12,12,24,24,28,26,22,20,20,24,18,22,22,18,24,20,18,18,20,30,30,30,

%U 22,16,14,22,24,24,28,20,20,18,14,22,30,30,30,24,24,26,34,32,22

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

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

%F a(n) = A031131(n) + A031131(n+2) = A001223(n) + A031165(n+1) and obvious variants. - _M. F. Hasler_, Dec 03 2018

%p A031166 := n -> ithprime(n+4)-ithprime(n);

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

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

%o (Haskell) a031166_list = zipWith (-) (drop 4 a000040_list) a000040_list

%o a031166 n = a031166_list !! (n-1) -- _Reinhard Zumkeller_, Aug 23 2015

%o (PARI) A031166(n)=prime(n+4)-prime(n) \\ _M. F. Hasler_, Dec 03 2018

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

%K nonn

%O 1,1

%A _Jeff Burch_

%E Offset changed from 2 to 1, and a(1)=9 added, by _Vincenzo Librandi_, Apr 23 2011