login
a(1) = 1; for n > 1, a(n) is the smallest prime that concatenated with all previous terms of the sequence forms a prime.
2

%I #39 Jul 04 2026 19:15:54

%S 1,3,7,3,41,7,23,7,89,3,139,29,643,419,43,29,37,29,79,251,1009,1283,

%T 61,389,79,467,409,431,3,199,1637,313,167,1789,881,709,263,109,1601,

%U 787,83,727,281,19,11,373,911,223,29,619,1451,43,5147,367,5471,1483,317,1483,521,2671

%N a(1) = 1; for n > 1, a(n) is the smallest prime that concatenated with all previous terms of the sequence forms a prime.

%C Also, a(1) = 1 and for n > 1, a(n) is the smallest prime p such that the concatenation of the digits of A397341(n-1) and p is prime.

%H Michael S. Branicky, <a href="/A397342/b397342.txt">Table of n, a(n) for n = 1..1000</a>

%F a(1) = 1 and for n > 1, a(n) = min {p prime : A397341(n)*10^d(p) + p is prime}, where d(p) is the number of decimal digits of p.

%e a(1) = 1.

%e a(2) = 3 since a(1)|3 = 1|3 = 13 is prime (and the concatenation 12 is not prime).

%e a(3) = 7 since a(1)|a(2)|7 = 13|7 = 137 is prime (and 132, 133 and 135 are not prime).

%e a(4) = 3 since a(1)|a(2)|a(3)|3 = 137|3 = 1373 is prime (and 1372 is not prime).

%e a(5) = 41 since a(1)|..|a(4)|41 = 1373|41 = 137341 is prime and no smaller prime p concatenated onto 1373 yields a prime.

%t next[F_] := NestWhile[NextPrime, 2, ! PrimeQ[F*10^IntegerLength[#] + #] &];

%t F = 1; seq = {1};

%t Do[p = next[F]; AppendTo[seq, p]; F = F*10^IntegerLength[p] + p, {60}];

%t seq

%Y Cf. A397341 (concatenation of these terms).

%Y Cf. A051670, A379354, A380010 (same but with beginning with 2, 3 and 7, resp.).

%K nonn,base

%O 1,2

%A _Md. Rad Sarar Anando_, Jun 21 2026