|
|
A113030
|
|
Largest prime arising that can be formed by stringing together the decimal expansions of some or all of the first n numbers in some order.
|
|
0
|
|
|
2, 31, 4231, 5431, 65423, 7652413, 8765423, 98765431, 10987653421, 111098765423, 12111098765413, 13121110987654231, 141312111098765213, 15141312111098763241, 16151413121110987654213, 171615141312111098764523
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
2,1
|
|
LINKS
|
|
|
EXAMPLE
|
a(3) = 31 as 321 or any other three digit permutation is not a prime and 23 < 31. Any permutation of all or a few of the first five numbers 1,2,3,4,5,gives the largest prime 5431. Hence a(5) = 5431.
|
|
MATHEMATICA
|
for 4<n<20 (* first do *) Needs["DiscreteMath`Combinatorica`"] (* then *) f[n_] := Block[{a = Flatten@IntegerDigits@Range[n, 6, -1], b = Flatten[ Permutations /@ Flatten[ Table[ KSubsets[ Range@5, i], {i, 5}], 1], 1], t = {}}, Do[AppendTo[t, Join[a, b[[k]] ]], {k, 325}]; Max@Select[FromDigits /@ t, PrimeQ[ # ] &]]; Table[ f[n], {n, 5, 18}] (* Robert G. Wilson v *)
|
|
CROSSREFS
|
|
|
KEYWORD
|
base,nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|