login
A158971
a(n) is the smallest number m such that m n's + 1 is prime and zero if there is no such m.
1
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, 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, 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
OFFSET
1,8
COMMENTS
I. If n is an odd number greater than 1 then a(n)=0. II. If n is greater
than 4 and mod(m,10)=4 then a(n)=0. III. If n+1 is prime the a(n)=1.
EXAMPLE
20+1 & 2020+1 aren't prime but 202020+1 is prime so a(20)=3. If n>4 and
mod(n,10)=4 then there is no number m such that m n's + 1 is prime because
5 divides all such numbers so a(n)=0.
MATHEMATICA
f[n_, m_]:=(v={}; Do[v=Join[v, IntegerDigits[n]], {k, m}]; FromDigits[v]);
a[n_]:=(If[n!=1&&n!=4&&(Mod[n, 10]==4||Mod[n, 2]==1), 0, For[m=1, !PrimeQ[f[n, m]
+1], m++ ]; m]); Do[Print[a[n]], {n, 104}]
CROSSREFS
Cf. A158972.
Sequence in context: A374328 A372505 A322338 * A121467 A366073 A362412
KEYWORD
nonn
AUTHOR
Farideh Firoozbakht, Apr 02 2009
STATUS
approved