The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A228323 a(1)=1; thereafter a(n) is the smallest number m not yet in the sequence such that at least one of the concatenations a(n-1)||m or m||a(n-1) is prime. 6

%I #38 Jan 02 2023 12:30:49

%S 1,3,2,9,5,21,4,7,6,13,10,19,16,27,8,11,15,23,12,17,20,29,14,33,26,47,

%T 18,31,25,39,22,37,24,41,30,49,34,57,28,43,36,59,32,51,38,53,42,61,45,

%U 67,58,69,55,63,44,81,35,71,48,77,50,87,62,99,40,73,46

%N a(1)=1; thereafter a(n) is the smallest number m not yet in the sequence such that at least one of the concatenations a(n-1)||m or m||a(n-1) is prime.

%C Does every number appear in the sequence?

%C 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]

%C The argument in A068695 shows that a(n) always exists. - _N. J. A. Sloane_, Nov 11 2020

%H Alois P. Heinz, <a href="/A228323/b228323.txt">Table of n, a(n) for n = 1..10000</a>

%H Eric Angelini, <a href="http://list.seqfan.eu/oldermail/seqfan/2013-August/011576.html">Primes by concatenation</a>, Posting to the Sequence Fans Mailing List, Aug 14 2013.

%H Michael De Vlieger, <a href="/A228323/a228323.png">Labeled log-log scatterplot of a(n)</a> n = 1..2^14, showing m coprime to 10 in red, otherwise dark blue.

%H <a href="/index/Pri#piden">Index entries for primes involving decimal expansion of n</a>

%t 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 *)

%o (Python)

%o from sympy import isprime

%o from itertools import islice

%o def c(s, t): return isprime(int(s+t)) or isprime(int(t+s))

%o def agen():

%o aset, k, mink = set(), 1, 2

%o while True:

%o an = k; aset.add(an); yield an; s, k = str(an), mink

%o while k in aset or not c(s, str(k)): k += 1

%o while mink in aset: mink += 1

%o print(list(islice(agen(), 56))) # _Michael S. Branicky_, Oct 17 2022

%Y See A228324 for the primes that arise.

%Y Cf. A069695, A228325.

%K nonn,base

%O 1,2

%A _N. J. A. Sloane_, Aug 20 2013

%E More terms from _Alois P. Heinz_, Aug 20 2013

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 29 00:29 EDT 2024. Contains 372921 sequences. (Running on oeis4.)