%I #24 May 07 2020 02:41:24
%S 2,31,331,832757,2683591,6363925717,1478441195963,8996779470869
%N Take a prime p and concatenate it with the next prime after p, q. If the result p||q is prime then take p+q and concatenate the sum to the next prime after q, r. If the result (p+q)||r is prime then take p+q+r and concatenate it to the next prime (s) after r, getting (p+r+r)||s, and so on. a(n) is the least prime for which this process continues for n steps.
%C i||j denotes the concatenation of the decimal expansions of i and j.
%H Carlos Rivera, <a href="https://www.primepuzzles.net/puzzles/puzz_995.htm">Puzzle 995. Another sequence of primes</a>, The Prime Puzzles and Problems Connection.
%e For p = prime(1) = 2 and prime(2) = 3 the concatenation 2||3 is prime; then 2+3 = 5 and the concatenation of 5 and prime(3) = 5 is 5||5 whicch is not a prime; so the process works for just one step, and a(1) = 2
%e For p = prime(11)= 31 and prime(12) = 37, the concatenation 31||37 is prime; then 31+37 = 68 and the concatenation of 68 and prime(13) = 41 is 68||41 which is prime; then 68+41 = 109 and the concatenation of 109 and prime(14) = 43 is 109||43 = 31*353 which is not prime; so the process ends after two steps. There is no prime < 31 such that the process continues for 2 steps, so a(2) = 31.
%t catQ[{m_, n_}] := PrimeQ @ FromDigits @ Join[IntegerDigits[m], IntegerDigits[n]]; f[{c_, p_}] := {c + p, NextPrime[p]}; s[p_] := Length @ NestWhileList[f, {0, p}, catQ] - 2; a[n_] := Module[{p = 2}, While[s[p] != n, p = NextPrime[p]]; p]; Array[a, 5] (* _Amiram Eldar_, Apr 15 2020 *)
%o (PARI) isok(p, n) = {my(s = p); for (i=1, n, my(q = nextprime(p+1)); if (!isprime(eval(Str(s, q))), return (0)); s += q; p = q;); return(1);}
%o a(n) = my(p=prime(1)); while (!isok(p, n), p=nextprime(p+1)); p;
%Y Cf. A030459, A309191.
%K nonn,base,more
%O 1,1
%A _Michel Marcus_, Apr 11 2020
%E a(6) from _Emmanuel Vantieghem_, Apr 15 2020
%E a(7)-a(8) from _Giovanni Resta_, Apr 15 2020
|