login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Start with 4; thereafter, primes obtained by concatenating to the end of previous term the next smallest number that will produce a prime.
0

%I #17 Jul 20 2024 13:23:18

%S 4,41,419,41911,4191119,41911193,419111933,41911193341,4191119334151,

%T 419111933415151,41911193341515187,4191119334151518719,

%U 419111933415151871963,41911193341515187196323,4191119334151518719632313,419111933415151871963231329

%N Start with 4; thereafter, primes obtained by concatenating to the end of previous term the next smallest number that will produce a prime.

%C a(n+1) is the next smallest prime beginning with a(n). Initial term is 4.

%C After a(1), these are the primes arising in A069606.

%e a(1) = 4 by definition.

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

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

%e ...and so on.

%t NestList[Module[{k=1},While[!PrimeQ[#*10^IntegerLength[k]+k],k+=2];#*10^IntegerLength[k]+ k]&,4,20] (* _Harvey P. Dale_, Jul 20 2024 *)

%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(4)

%Y Cf. A110773, A048553, A069606.

%K nonn,base

%O 1,1

%A _Derek Orr_, Jan 27 2014