login
A158972
a(n) is the smallest number m such that m n's - 1 is prime and zero if there is no such m.
1
0, 4, 1, 1, 0, 1, 0, 1, 0, 2, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 2, 0, 1, 0, 0, 0, 3, 0, 1, 0, 1, 0, 2, 0, 0, 0, 1, 0, 3270, 0, 1, 0, 1, 0, 0, 0, 1, 0, 3, 0, 957, 0, 1, 0, 0, 0, 2, 0, 1, 0, 1, 0, 5853, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 2, 0, 1, 0, 783, 0, 1, 0
OFFSET
1,2
COMMENTS
I. If m=1 or m is an odd number greater than 3 then a(m)=0. II. If m is greater
than 6 and mod(m,10)=6 then a(m)=0. III. If n-1 is prime the a(n)=1.
a(64) is greater than 4000.
EXAMPLE
2-1, 22-1 & 222-1 aren't prime and 2222-1 is prime so a(2)=4. There is no m
such that m 16's -1 is prime because 5 divides all such numbers, so a(16)=0.
MATHEMATICA
f[n_, m_]:=(v={}; Do[v=Join[v, IntegerDigits[n]], {k, m}]; FromDigits[v]);
a[n_]:=(If[n!=3&&n!=6&&(Mod[n, 10]==6||Mod[n, 2]==1), 0, For[m=1, !PrimeQ[f[n, m]
-1], m++ ]; m]); Do[Print[a[n]], {n, 39}]
CROSSREFS
Cf. A158971.
Sequence in context: A299354 A117414 A085639 * A372173 A278987 A135302
KEYWORD
nonn,base
AUTHOR
Farideh Firoozbakht, Apr 02 2009
EXTENSIONS
a(64)-a(85) from Giovanni Resta, Apr 17 2017
STATUS
approved