login
A096915
Smallest prime which when appended to n produces a prime.
8
3, 3, 7, 3, 3, 7, 3, 3, 7, 3, 3, 7, 7, 23, 7, 3, 3, 11, 3, 11, 11, 3, 3, 11, 7, 3, 7, 3, 3, 7, 3, 17, 7, 7, 3, 7, 3, 3, 7, 13, 11, 11, 3, 3, 7, 3, 23, 7, 19, 3, 13, 3, 23, 7, 7, 3, 7, 7, 3, 7, 3, 11, 11, 3, 3, 19, 3, 3, 11, 13, 29, 7, 3, 3, 7, 43, 3, 7, 7, 11, 11, 3, 11, 19, 3, 3, 7, 3, 23, 7, 37, 41
OFFSET
1,1
EXAMPLE
a(20)=11 because 11 is prime and 2011 is the smallest prime starting with 20 (2003 is not allowed).
MATHEMATICA
f[n_] := Block[{p = 2, a = IntegerDigits[n]}, While[ !PrimeQ[ FromDigits[ Join[a, IntegerDigits[ Prime[p]]] ]], p++ ]; Prime[p]]; Table[ f[n], {n, 92}] (* Robert G. Wilson v, Aug 20 2004 *)
sp[n_]:=Module[{p=3}, While[CompositeQ[n*10^IntegerLength[p]+p], p= NextPrime[ p]]; p]; Array[sp, 100] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Aug 26 2019 *)
PROG
(PARI) A096915(n) = { local(p=1); until(isprime(eval(Str(n, p=nextprime(p+2)))), ); p} \\ M. F. Hasler, Jan 05 2009
CROSSREFS
Cf. A088606, A089777 (the resulting primes). Records: A137177, A144593.
Sequence in context: A366973 A076560 A359048 * A249806 A249382 A317929
KEYWORD
nonn,base
AUTHOR
Bodo Zinser, Aug 18 2004
EXTENSIONS
More terms from Robert G. Wilson v, Aug 20 2004
Cross-reference to indices of records corrected by M. F. Hasler, Jan 14 2009
STATUS
approved