%I #37 Jan 19 2019 14:33:12
%S 0,1,1,2,1,2,1,4,2,1,2,2,1,3,2,2,1,2,2,1,2,3,2,5,2,1,2,1,3,5,3,2,1,4,
%T 1,2,2,3,2,2,1,3,1,2,1,3,3,2,1,4,2,1,3,2,2,2,1,2,2,1,3,4,2,1,4,3,2,3,
%U 1,3,2,3,2,2,3,2,3,4,3,3,1,4,1,2,5,2,3,2,1,4,4,3,5,3,4,2,4,1,4,2
%N a(n) = least k such that prime(n) + A002110(k) is prime.
%C Conjecture: every prime number can be written as +- p(n) -+ p(k)# where p(i)=i-th prime, p(i)#=i-th primorial.
%C The sequence grows remarkably slowly. The largest number occurring within the first 50000 elements is 90. - _Stefan Steinerberger_, Apr 10 2006
%C a(1) = 0 is the minimum value of a(n). It is also unrepeated in this sequence. - _Altug Alkan_, Dec 02 2015
%H Robert Israel, <a href="/A100380/b100380.txt">Table of n, a(n) for n = 1..10000</a> (corrected by Ray Chandler, Jan 19 2019)
%e p(8)=19;
%e 19 + 2 = 21 = 3*7,
%e 19 + 6 = 25 = 5*5, and
%e 19 + 30 = 49 = 7*7, but
%e 19 + 210 = 229, which is prime; 210=p(4)#, so a(8)=4.
%p primorial:= proc(n) option remember: ithprime(n)*procname(n-1) end proc:
%p primorial(0):= 1:
%p f:= proc(n) local k, p;
%p p:= ithprime(n);
%p for k from 0 do if isprime(p+primorial(k)) then return k fi od:
%p end proc:
%p map(f, [$1..100]);# _Robert Israel_, Aug 27 2015
%t Table[k := 0;While[Not[PrimeQ[Prime[n]+Product[Prime[i],{i,1,k}]]],k++ ];k,{n,1, 100}] (* _Stefan Steinerberger_, Apr 10 2006 *)
%o (PARI) primo(n) = prod(i=1, n, prime(i));
%o a(n) = {k=0; while(!isprime(prime(n)+primo(k)), k++); k;} \\ _Michel Marcus_, Aug 27 2015
%Y Cf. A002110, A265109.
%K easy,nonn
%O 1,4
%A _Pierre CAMI_, Dec 30 2004
%E More terms from _Stefan Steinerberger_, Apr 10 2006
%E a(1) = 0 added and name edited by _Altug Alkan_, Dec 02 2015