OFFSET
1,2
COMMENTS
Does every number appear in the sequence?
If a(n) is coprime to 10, then a(n+1) exists by Dirichlet's theorem. - Eric M. Schmidt, Aug 20 2013 [In more detail: let a(n) have d digits, and consider the arithmetic progression k*10^d + a(n), and apply Dirichlet's theorem. This gives a number k such that the concatenation k||a(n) is prime. N. J. A. Sloane, Nov 08 2020]
The argument in A068695 shows that a(n) always exists. - N. J. A. Sloane, Nov 11 2020
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..10000
Eric Angelini, Primes by concatenation, Posting to the Sequence Fans Mailing List, Aug 14 2013.
Michael De Vlieger, Labeled log-log scatterplot of a(n) n = 1..2^14, showing m coprime to 10 in red, otherwise dark blue.
MATHEMATICA
f[s_] := Block[{k = 2, idj = IntegerDigits@ s[[-1]]}, While[idk = IntegerDigits@ k; MemberQ[s, k] || ( !PrimeQ@ FromDigits@ Join[idj, idk] && !PrimeQ@ FromDigits@ Join[idk, idj]), k++]; Append[s, k]]; Nest[f, {1}, 66] (* Robert G. Wilson v, Aug 20 2013 *)
PROG
(Python)
from sympy import isprime
from itertools import islice
def c(s, t): return isprime(int(s+t)) or isprime(int(t+s))
def agen():
aset, k, mink = set(), 1, 2
while True:
an = k; aset.add(an); yield an; s, k = str(an), mink
while k in aset or not c(s, str(k)): k += 1
while mink in aset: mink += 1
print(list(islice(agen(), 56))) # Michael S. Branicky, Oct 17 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
N. J. A. Sloane, Aug 20 2013
EXTENSIONS
More terms from Alois P. Heinz, Aug 20 2013
STATUS
approved