login

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”).

A218344
Smallest k such that k*(n-th composite)+1 is prime.
3
1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 3, 4, 2, 4, 1, 1, 3, 2, 3, 2, 1, 5, 2, 1, 1, 2, 4, 1, 2, 4, 2, 2, 1, 2, 6, 2, 4, 1, 1, 5, 2, 3, 2, 1, 2, 2, 1, 1, 2, 2, 3, 6, 1, 3, 2, 1, 4, 12, 2, 4, 1, 2, 6, 3, 4, 3, 2, 1, 2, 2, 1, 1, 3, 2, 1, 1, 3, 2, 1, 2, 4, 2, 8, 6, 2
OFFSET
1,3
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000 (terms 1..1000 from T. D. Noe)
EXAMPLE
The composite numbers are A002808. a(1) is 1 since the first composite number is 4, and 4*1+1=5, a prime. a(14)=3 since the 14th composite is 24, and 24*3+1=73 prime, while 25 and 49 are not.
MATHEMATICA
t={}; For[k = 4, k < 200, k++, If[!PrimeQ[k], Mult = 1; While[! PrimeQ[k*Mult + 1], Mult = Mult + 1]; AppendTo[t, Mult]]]; t
sk[n_]:=Module[{k=1}, While[!PrimeQ[k*n+1], k++]; k]; nn=150; With[{cmps= Complement[ Range[4, nn], Prime[Range[PrimePi[nn]]]]}, sk/@cmps] (* Harvey P. Dale, Apr 16 2013 *)
PROG
(Python)
from sympy import composite, isprime
def a(n):
cn, k = composite(n), 1
while not isprime(k*cn + 1): k += 1
return k
print([a(n) for n in range(1, 89)]) # Michael S. Branicky, Jun 07 2022
CROSSREFS
Cf. A002808.
Sequence in context: A211263 A303827 A323116 * A211272 A298600 A292470
KEYWORD
nonn,easy
AUTHOR
William J. Keith, Oct 26 2012
STATUS
approved