login
a(1) = 2; thereafter a(n+1) is the smallest prime not yet in the sequence such that the concatenation a(n) || a(n+1) is prime if n is odd, or composite if n is even.
2

%I #26 Jul 03 2024 12:42:28

%S 2,3,5,23,7,19,11,17,13,61,29,53,31,37,41,59,43,73,47,83,67,79,71,167,

%T 89,101,97,103,107,137,109,139,113,131,127,157,149,173,151,163,179,

%U 233,181,193,191,227,197,257,199,211,223,229,239,251,241,271,263,269,277,331,281,317,283,397,293,311,307,337,347,359,313,373,353,389,349

%N a(1) = 2; thereafter a(n+1) is the smallest prime not yet in the sequence such that the concatenation a(n) || a(n+1) is prime if n is odd, or composite if n is even.

%C First differs from A244862 at n = 69.

%H Paolo P. Lava, <a href="/A373794/b373794.txt">Table of n, a(n) for n = 1..1000</a>

%p P:=proc(q) local a,k,i,n,t; a:=[2]; for n from 1 to q do k:=1;

%p if frac(n/2)>0 then t:=1; else t:=0; fi;

%p for i do k:=nextprime(k); if numboccur(k,a)=0 then if t=1 then

%p if isprime(a[n]*10^length(k)+k) then a:=[op(a),k]; break; fi;

%p else if not isprime(a[n]*10^length(k)+k) then a:=[op(a),k]; break;

%p fi; fi; fi; od; od; print(op(a)); end: P(10^3); # _Paolo P. Lava_, Jul 03 2024

%Y Cf. A244862.

%K nonn,base

%O 1,1

%A _N. J. A. Sloane_, Jul 03 2024, based on an email from _Paolo P. Lava_.

%E More than the usual number of terms are shown in order to distinguish this from A244862.