OFFSET
1,1
COMMENTS
Split permutations of the digits 1 through 9 into three-digit parts, treat each part as a number, and total those numbers. The sequence contains all of the possible sums.
REFERENCES
David Wells, The Penguin Dictionary of Curious and Interesting Numbers (Rev. ed. 1997), p. 149 (entry for 999).
EXAMPLE
149 + 263 + 587 = 999, and 149, 263, and 587 are all primes, so 999 is a (the smallest) term of the sequence. 653 + 827 + 941 = 2421, and 653, 827, and 941 are all primes, so 2421 is a (the largest) term of the sequence.
MATHEMATICA
Union[Transpose[Join[#, {Total[#]}]&/@(FromDigits/@Partition[#, 3]&/@ Select[Permutations[Range[9]], And@@PrimeQ[FromDigits/@ Partition[ #, 3]]&])][[4]]]
PROG
(Python)
from sympy import isprime
from itertools import permutations
aset = set()
for p in permutations("123456789"):
p = [int("".join(p[i*3:(i+1)*3])) for i in range(3)]
if all(isprime(pi) for pi in p): aset.add(sum(p))
print(sorted(aset)) # Michael S. Branicky, Jun 28 2021
CROSSREFS
KEYWORD
nonn,fini,full,base
AUTHOR
Harvey P. Dale, Jun 16 2013
EXTENSIONS
Name clarified by Tanya Khovanova, Jul 05 2021
STATUS
approved