Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #8 May 04 2013 14:36:46
%S 1,1,1,2,1,1,3,1,1,2,1,2,3,1,1,5,5,1,9,1,1,2,1,2,3,1,3,3,1,1,9,2,1,2,
%T 1,1,3,4,1,5,1,2,3,1,3,2,5,1,3,1,1,2,1,1,5,1,3,3,11,2,5,4,1,2,1,2,3,1,
%U 1,2,7,5,3,1,1,2,5,1,3,2,1,8,1,3,11,1,3,3,1,1,5,2,3,2,1,1,3,1,1,3,5,2,5,2,1,6,5,3,9,2,1,2,1,1,3,1,7,5,1,1,5,2,5,2,1,2,3,1,7,3,1,2,11,1,1,2,5,1,3,1,1,3,5,2,9,1,5,3
%N Smallest positive k such that n+k(n-1) is prime
%C Given n fenceposts, what is the minimum (but greater than zero) number of new posts which can be inserted between each consecutive pair of original posts to obtain a prime number of total posts?
%C Where the minimum is allowed to be zero, substitute a(n) = 0 for prime n.
%C a(n) is 1 when 2n-1 is prime, which is equivalent to a((p+1)/2)=1 for prime p > 2, therefore there are an infinite number of pairs of consecutive 1s in the sequence if the twin prime conjecture is true.
%H Carl R. White, <a href="/A214123/b214123.txt">Table of n, a(n) for n = 2..10000</a>
%e For n = 5, we have fenceposts like so: ||||| . To insert 1 post between each pair of original posts would leave us with 9 posts: |;|;|;|;|, which is not prime. Inserting two: |;;|;;|;;|;;| gives 13 posts. This is prime so a(5) = 2.
%t spk[n_]:=Module[{k=1},While[!PrimeQ[n+k(n-1)],k++];k]; Array[spk,150,2] (* _Harvey P. Dale_, May 04 2013 *)
%Y Cf. A214124, A214125
%K nonn,easy
%O 2,4
%A _Carl R. White_, Jul 04 2012