A085909 Smallest prime p>prime(n) such that p+prime(n+1)-prime(n) is the next prime after p; or a(n)=0 if no such prime exists.
0, 5, 11, 13, 17, 19, 29, 37, 31, 41, 47, 43, 59, 67, 53, 61, 71, 73, 79, 101, 83, 97, 131, 359, 103, 107, 109, 137, 127, 293, 163, 151, 149, 181, 179, 157, 167, 193, 173, 233, 191, 241, 197, 223, 227, 211, 467, 229, 239, 277, 251, 269, 283, 257, 263, 271, 281
Offset: 1
Keywords
Links
- Zak Seidov, Table of n, a(n) for n = 1..10000
- Eric Weisstein's World of Mathematics, Prime Difference Function
Programs
-
MATLAB
P = primes(5000); A = zeros(1, length(P));D = P(2:end) - P(1:(length(P) - 1)); for i = 2:2:(max(D));f = find(D == i); A(f(1:(length(f) - 1))) = P(f(2:end));end;A(2:100) % David Wasserman, Jan 26 2004
-
Mathematica
a[1] = 0; a[n_] := For[p = Prime[n+1]; d = p - Prime[n], True, p = q, q = NextPrime[p]; If[d == q - p, Return[p]]]; (* Jean-François Alcover, Feb 24 2015 *)
Extensions
More terms from Reinhard Zumkeller and David Wasserman, Jan 26 2004
Edited by N. J. A. Sloane, Oct 21 2008 at the suggestion of R. J. Mathar
Comments