login
a(n) = prime(n+3) - prime(n).
17

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

%S 5,8,8,10,8,10,12,12,14,12,12,10,12,16,14,14,12,12,12,12,16,18,18,14,

%T 10,8,10,20,22,24,12,18,14,18,14,16,16,16,14,18,14,16,8,18,26,28,18,

%U 10,12,12,18,18,22,18,14,14,12,12,16,26,28,20,10,20,24,30,18,16,12

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

%C Comments from _Jonathan Vos Post_, Jan 22 2006 (Start): This sequence is the k=3 case of the family of sequences a(k,n) = prime(n+k) - prime(n). See A001223 and A031131 for k = 1 and 2.

%C The records in this sequence give A115401. The minimal value, after the anomalous initial values (5, 8, 8), is 8 which occurs iff n is an element of A007530 (prime quadruples: numbers n such that n, n+2, n+6, n+8 are all prime). (End)

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

%F a(n) = prime(n+3) - prime(n). a(n) = A000040(n+3) - A000040(n). - _Jonathan Vos Post_, Jan 22 2006

%F a(n) = A034961(n+1) - A034961(n). - _Zak Seidov_, Nov 07 2012

%e a(1) = prime(4) - prime(1) = 7 - 2 = 5, which is the only odd element of this sequence.

%e a(2) = prime(5) - prime(2) = 11 - 3 = 8.

%e a(3) = prime(6) - prime(3) = 13 - 5 = 8.

%e a(4) = prime(7) - prime(4) = 17 - 7 = 10.

%e a(99) = prime(102) - prime(99) = 557 - 523 = 34. - _Jonathan Vos Post_, Jan 22 2006

%p a:= n-> ithprime(n+3)-ithprime(n): seq (a(n), n=1..80);

%t t = Array[Prime, 75]; Drop[t, 3] - Drop[t, -3] (* _Robert G. Wilson v_ *)

%t #[[4]]-#[[1]]&/@Partition[Prime[Range[80]],4,1] (* _Harvey P. Dale_, Nov 07 2021 *)

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

%o (PARI) p=2;q=3;r=5;forprime(s=7,1e3,print1(s-p", "); p=q;q=r;r=s) \\ _Charles R Greathouse IV_, Nov 07 2012

%o (Haskell)

%o a031165 n = a031165_list !! (n-1)

%o a031165_list = zipWith (-) (drop 3 a000040_list) a000040_list

%o -- _Reinhard Zumkeller_, Aug 23 2015

%Y Cf. A000040, A001223, A007530, A031131, A034961, A115401.

%Y Cf. A031166, A031167, A031168, A031169, A031170, A031171, A031172.

%K nonn

%O 1,1

%A _Jeff Burch_, Dec 11 1999

%E Edited by _R. J. Mathar_ and _N. J. A. Sloane_, Aug 11 2008