OFFSET
1,1
COMMENTS
Sequence of corresponding values k (see definition; 0 if no prime exists) is 1, 1, 1, 3, 3, 1, 3, 3, 1, 1, 3, 3, 1, 4, 3, 1, 1, 0, 1, 1, 1, 3, 0, 0, 0, 1, 1, 1, 3, 0, 9, 4, 3, 1, 1, 0, 1, 3, 1, 2, 1, 0, 3, 2, 1, 1, 5, 11, 1, 1, 3.
a(n) = 0 if n and s(n) are not coprime, otherwise there are infinitely many primes in the arithmetic progression k*n+s(n) for k >= 1 (Dirichlet's theorem).
Even if the zero terms are ignored, the sequence is not monotone increasing: a(31) = 1999 > a(32) = 1979, a(48) = 5189 > a(49) = 4937.
LINKS
Eric Weisstein's World of Mathematics, Dirichlet's Theorem
EXAMPLE
For n = 1 we have s(n) = 2; 1*n+s(n) = 3 is prime, hence a(1) = 3.
For n = 4 we have s(n) = 17; 1*n+s(n) = 21 and 2*n+s(n) = 25 are composite, but 3*n+s(n) = 29 is prime, hence a(4) = 29.
For n = 18 we have s(n) = 501; 18 and 501 have common divisor 3, hence k*n+s(n) is divisible by 3 for k >= 1 and a(18) = 0.
For n = 48 we have s(n) = 4661; k*n+s(n) is composite for k <= 10, but 11*n+s(n) = 5189 is prime, hence a(48) = 5189.
MATHEMATICA
s[1] = 2; s[n_] := s[n] = s[n-1] + Prime[n]; a[n_ /; !CoprimeQ[n, s[n]]] = 0; a[n_] := For[k = 1, True, k++, If[PrimeQ[p = k*n + s[n]], Return[p]]]; Table[a[n], {n, 1, 51}] (* Jean-François Alcover, Oct 02 2013 *)
PROG
(Magma) smallest:=function(n, s) if Gcd(n, s) gt 1 then return 0; else a:=n+s; while not IsPrime(a) do a+:=n; end while; return a; end if; end function; S:=[]; s:=0; for n in [1..51] do s+:=NthPrime(n); Append(~S, smallest(n, s)); end for; S; // Klaus Brockhaus, Jun 12 2009
CROSSREFS
KEYWORD
nonn
AUTHOR
Ulrich Krug (leuchtfeuer37(AT)gmx.de), Jun 11 2009
EXTENSIONS
Edited by Klaus Brockhaus, Jun 12 2009
STATUS
approved