login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A309877 a(n) is the smallest number k such that the difference between the next prime greater than k and k equals n. 1

%I #12 Aug 23 2019 14:38:12

%S 1,0,8,7,24,23,90,89,118,117,116,115,114,113,526,525,524,523,888,887,

%T 1130,1129,1338,1337,1336,1335,1334,1333,1332,1331,1330,1329,1328,

%U 1327,9552,9551,15690,15689,15688,15687,15686,15685,15684,15683,19616,19615,19614,19613,19612,19611

%N a(n) is the smallest number k such that the difference between the next prime greater than k and k equals n.

%H Robert Israel, <a href="/A309877/b309877.txt">Table of n, a(n) for n = 1..282</a>

%F a(n) = min {k : A013632(k) = n}.

%e +------+------+-----+

%e | a(n) | next | gap |

%e | | prime| |

%e +------+------+-----+

%e | 1 | 2 | 1 |

%e | 0 | 2 | 2 |

%e | 8 | 11 | 3 |

%e | 7 | 11 | 4 |

%e | 24 | 29 | 5 |

%e | 23 | 29 | 6 |

%e | 90 | 97 | 7 |

%e | 89 | 97 | 8 |

%e +------+------+-----+

%p N:= 100:

%p A:= Vector(N,-1):

%p count:= 0: lastp:= 0:

%p while count < N do

%p p:= nextprime(lastp);

%p newvals:= select(t -> A[t]=-1, [$1..min(p-lastp,N)]);

%p count:= count+nops(newvals);

%p for k in newvals do A[k]:= p-k od;

%p lastp:= p;

%p od:

%p convert(A,list); # _Robert Israel_, Aug 23 2019

%t Table[SelectFirst[Range[0, 20000], NextPrime[#] - # == n &], {n, 1, 50}]

%o (PARI) a(n) = my(k=0); while(nextprime(k+1) - k != n, k++); k; \\ _Michel Marcus_, Aug 21 2019

%Y Cf. A000101, A000230, A007918, A007920, A013632, A051652, A075403, A077019, A151800.

%K nonn

%O 1,3

%A _Ilya Gutkovskiy_, Aug 21 2019

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 24 17:11 EDT 2024. Contains 375417 sequences. (Running on oeis4.)