%I #16 Dec 06 2021 03:16:37
%S 2,23,523,7523,751123,75311213,7523171311,753217131911,75323219131117,
%T 0,753312923219111713,75373312923192171311,7541373132923217111319,
%U 754341373132923192171311,75474341373132923211171319
%N Largest prime concatenation of the first n primes, or 0 if no such prime exists.
%C a(10) doesn't exist, because the sum of digits of the first 10 primes (2+3+5+7+(1+1)+(1+3)+(1+7)+(1+9)+(2+3)+(2+9)) = 57 is a multiple of 3.
%D Richard E. Crandall and Carl Pomerance, Prime Numbers, Springer 2005.
%D Paulo Ribenboim, The New Book of Prime Number Records, Springer 1996.
%D A. Weil, Number theory: an approach through history, Birkhäuser 1984.
%H Gleb Ivanov, <a href="/A167417/a167417.py.txt">Python program for large terms</a>.
%e The only prime concatenations of the first n primes for n = 1..3 are a(1)=2, a(2)=23, and a(3)=523.
%e For n=4, the only prime concatenations of 2, 3, 5, and 7 are 2357, 2753, 3257, 3527, 5237, 5273, 7253, 7523; the largest of these is a(4) = 7523.
%o (Python)
%o from sympy import sieve, isprime
%o from itertools import permutations
%o for n in range(1, 14):
%o sieve.extend_to_no(n)
%o p = list(map(str, list(sieve._list)))[:n]
%o mint = 0
%o for i in permutations(p, len(p)):
%o t = int(''.join(i))
%o if t > mint and isprime(t):
%o mint = t
%o print(mint, end = ', ') # _Gleb Ivanov_, Dec 05 2021
%Y Cf. A175429, A177275, A134966, A167416.
%K nonn,base
%O 1,1
%A Eva-Maria Zschorn (e-m.zschorn(AT)zaschendorf.km3.de), Nov 03 2009
%E Edited by _Charles R Greathouse IV_, Apr 28 2010
%E Several terms corrected and a(11)-a(15) from _Gleb Ivanov_, Dec 05 2021
|