OFFSET
2,4
COMMENTS
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?
Where the minimum is allowed to be zero, substitute a(n) = 0 for prime n.
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.
LINKS
Carl R. White, Table of n, a(n) for n = 2..10000
EXAMPLE
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.
MATHEMATICA
spk[n_]:=Module[{k=1}, While[!PrimeQ[n+k(n-1)], k++]; k]; Array[spk, 150, 2] (* Harvey P. Dale, May 04 2013 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Carl R. White, Jul 04 2012
STATUS
approved