A068695 Smallest number (not beginning with 0) that yields a prime when placed on the right of n.
1, 3, 1, 1, 3, 1, 1, 3, 7, 1, 3, 7, 1, 9, 1, 3, 3, 1, 1, 11, 1, 3, 3, 1, 1, 3, 1, 1, 3, 7, 1, 17, 1, 7, 3, 7, 3, 3, 7, 1, 9, 1, 1, 3, 7, 1, 9, 7, 1, 3, 13, 1, 23, 1, 7, 3, 1, 7, 3, 1, 3, 11, 1, 1, 3, 1, 3, 3, 1, 1, 9, 7, 3, 3, 1, 1, 3, 7, 7, 9, 1, 1, 9, 19, 3, 3, 7, 1, 23, 7, 1, 9, 7, 1, 3, 7, 1, 3, 1, 9, 3, 1
Offset: 1
Examples
a(20)=11 because 11 is the minimum odd number which when appended to 20 forms a prime (201, 203, 205, 207, 209 are all nonprime, 2011 is prime).
Links
- David W. Wilson, Table of n, a(n) for n=1..10000
- Max Alekseyev, Given n, there is a k such that the concatenation n||k is a prime, Nov 09 2020
- Index entries for primes involving decimal expansion of n
Crossrefs
Programs
-
Mathematica
d[n_]:=IntegerDigits[n]; t={}; Do[k=1; While[!PrimeQ[FromDigits[Join[d[n],d[k]]]],k++]; AppendTo[t,k],{n,102}]; t (* Jayanta Basu, May 21 2013 *) mon[n_]:=Module[{k=1},While[!PrimeQ[n*10^IntegerLength[k]+k],k+=2];k]; Array[mon,110] (* Harvey P. Dale, Aug 13 2018 *)
-
PARI
A068695=n->for(i=1,oo,ispseudoprime(eval(Str(n,i)))&&return(i)) \\ M. F. Hasler, Oct 29 2013
-
Python
from sympy import isprime from itertools import count def a(n): return next(k for k in count(1) if isprime(int(str(n)+str(k)))) print([a(n) for n in range(1, 103)]) # Michael S. Branicky, Oct 18 2022
Extensions
More terms from Chuck Seggelin, Dec 18 2003
Entry revised by N. J. A. Sloane, Feb 20 2006
More terms from David Wasserman, Feb 14 2006
Comments