%I #27 Mar 04 2020 16:55:20
%S 2,23,257,2357,112573,11132357,1113223537,111317193257,11131719223357,
%T 1113171922335437,111317192232934157,11131719223293135773,
%U 1113171922329313375759,111317192232931337415743,11131719223293133741435717
%N Smallest prime which is a concatenation of n distinct primes.
%e a(5) = 112573 is a concatenation of 11,2,5,7 and 3 and is the smallest such prime.
%e a(7) <= 1113223537 = 11//13//2//23//5//3//7. - _R. J. Mathar_, Mar 19 2011
%e a(8) <= 111317193257 = 11//13//17//19//3//2//5//7. - _Jonathan Vos Post_, Mar 20 2006
%e a(9) <= 11131719223357 = 11//13//17//19//2//23//3//5//7. - _R. J. Mathar_, Mar 19 2011
%o (Sage)
%o concat = lambda x: Integer(''.join(str(i) for i in x),base=10)
%o def A083427(n):
%o def primelists(sofar, widths):
%o if not widths: yield sofar; return
%o w = widths[0]
%o for p in prime_range(10**(w-1), 10**w):
%o if p not in sofar:
%o for pv in primelists(sofar+[p], widths[1:]):
%o yield pv
%o for numdig in PositiveIntegers():
%o least = None
%o for part in Partitions(numdig, length=n):
%o if list(part).count(1) > 4: continue # optimization
%o for sizes in Permutations(part):
%o for plist in primelists([], sizes):
%o x = concat(plist)
%o if is_prime(x): least = min(x, least) if least else x
%o # since x is increasing in this inner loop,
%o # no need to continue if we can't improve
%o if least and x >= least: break
%o if least: return least # _D. S. McNeil_, Mar 20 2011
%Y Cf. A000040.
%K base,more,nonn
%O 1,1
%A _Amarnath Murthy_ and Meenakshi Srikanth (menakan_s(AT)yahoo.com), Apr 29 2003
%E a(7), a(8) from _Jonathan Vos Post_, Mar 20 2006
%E a(7) corrected by _Emmanuel Vantieghem_, Mar 19 2011
%E a(8) deleted on grounds that it is quite likely to be wrong. - _N. J. A. Sloane_, Mar 19 2011
%E a(7)-a(15) from _D. S. McNeil_, Mar 20 2011
|