%I #2 Mar 30 2012 17:37:48
%S 1,1,0,1,0,1,0,2,0,1,0,1,0,0,0,1,0,1,0,3,0,1,0,0,0,3,0,1,0,1,0,3,0,0,
%T 0,1,0,3,0,1,0,1,0,0,0,1,0,1950,0,2,0,1,0,0,0,2,0,1,0,1,0,2,0,0,0,1,0,
%U 2,0,1,0,1,0,0,0,3,0,1,0,2,0,1,0,0,0,87,0,1,0,2,0,2,0,0,0,1,0,5,0,1,0,1,0,0
%N a(n) is the smallest number m such that m n's + 1 is prime and zero if there is no such m.
%C I. If n is an odd number greater than 1 then a(n)=0. II. If n is greater
%C than 4 and mod(m,10)=4 then a(n)=0. III. If n+1 is prime the a(n)=1.
%e 20+1 & 2020+1 aren't prime but 202020+1 is prime so a(20)=3. If n>4 and
%e mod(n,10)=4 then there is no number m such that m n's + 1 is prime because
%e 5 divides all such numbers so a(n)=0.
%t f[n_,m_]:=(v={};Do[v=Join[v,IntegerDigits[n]],{k,m}];FromDigits[v]);
%t a[n_]:=(If[n!=1&&n!=4&&(Mod[n,10]==4||Mod[n,2]==1),0,For[m=1,!PrimeQ[f[n,m]
%t +1],m++ ];m]);Do[Print[a[n]],{n,104}]
%Y Cf. A158972.
%K nonn
%O 1,8
%A _Farideh Firoozbakht_, Apr 02 2009