login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Primes obtained by concatenating to the end of previous term the next smallest number that will produce a prime, starting with 3.
1

%I #18 Jun 22 2020 19:38:35

%S 3,31,311,3119,31193,3119317,31193171,311931713,3119317139,

%T 311931713939,31193171393933,3119317139393353,31193171393933531,

%U 3119317139393353121,311931713939335312127,311931713939335312127113,31193171393933531212711399,31193171393933531212711399123

%N Primes obtained by concatenating to the end of previous term the next smallest number that will produce a prime, starting with 3.

%C a(n + 1) is the next smallest prime beginning with a(n). Initial term is 3. These are the primes arising in A069605.

%e a(1) = 3 by definition.

%e a(2) is the next smallest prime beginning with 3, so a(2) = 31.

%e a(3) is the next smallest prime beginning with 31, so a(3) = 311.

%t A069605[1] = 3; A236527[1] = 3; A069605[n_] := A069605[n] = Block[{k = 1, c = IntegerDigits @ Table[ a[i], {i, n - 1}]}, While[ !PrimeQ[ FromDigits[Flatten[Append[c, IntegerDigits[k]]]]], k += 2]; k]; A236527[n_] := A236527[n] = FromDigits[Flatten[IntegerDigits[A236527[n - 1]], IntegerDigits[A069605[n]]]]; Table[A236527[n], {n, 20}] (* _Alonso del Arte_, Jan 28 2014 based on _Robert G. Wilson v_'s program for A069605 *)

%t nxt[n_]:=Module[{s=1},While[CompositeQ[n*10^IntegerLength[s]+s],s+=2];n*10^IntegerLength[s]+s]; NestList[nxt,3,20] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Jun 22 2020 *)

%o (Python)

%o import sympy

%o from sympy import isprime

%o def b(x):

%o ..num = str(x)

%o ..n = 1

%o ..while n < 10**3:

%o ....new_num = str(x) + str(n)

%o ....if isprime(int(new_num)):

%o ......print(int(new_num))

%o ......x = new_num

%o ......n = 1

%o ....else:

%o ......n += 1

%o b(3)

%Y Cf. A048553, A110773, A069605.

%K nonn,base

%O 1,1

%A _Derek Orr_, Jan 27 2014