A214123 Smallest positive k such that n+k(n-1) is prime.
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, 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, 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
Offset: 2
Examples
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.
Links
- Carl R. White, Table of n, a(n) for n = 2..10000
Programs
-
Mathematica
spk[n_]:=Module[{k=1},While[!PrimeQ[n+k(n-1)],k++];k]; Array[spk,150,2] (* Harvey P. Dale, May 04 2013 *)
Comments