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

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