OFFSET
1,2
COMMENTS
Conjecture a(n) = 0 only for n = 1, or n == 0 (mod 3), n is > 3. Subsidiary sequence (hard): Number of primes generated by concatenation of distinct partitions of n.
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..93
Michael S. Branicky, Python program
EXAMPLE
Distinct partitions of 10 are (10), (9,1), (8,2), (7,3), (6,4), (7,2,1), (6,3,1), (5,3,2), (5,4,1), (4,3,2,1). a(10) = 4231 is the largest prime obtained as a concatenation of (4,2,3,1).
PROG
(PARI) a(n) = my(best=0, cur); forpart(u=n, if(#Set(u)==#u, forperm(u, v, cur=eval(concat(apply(x->Str(x), Vec(v)))); if(isprime(cur), best=max(best, cur))))); best \\ Jason Yuen, Sep 05 2024
(Python) # see link for faster version
from itertools import permutations
from gmpy2 import digits, is_prime, mpz
def dparts(n, high=0): # distinct partitions of n with terms > high
if n > high: yield (n, )
for i in range(high+1, n):
yield from ((i, )+p for p in dparts(n-i, i))
def a(n):
return max((int(t) for dp in dparts(n) for p in permutations(list(map(str, dp))) if is_prime(t:=mpz("".join(p)))), default=0)
print([a(n) for n in range(1, 41)]) # Michael S. Branicky, Sep 07 2024
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Amarnath Murthy, Aug 04 2005
EXTENSIONS
Corrected and extended by R. J. Mathar, Feb 08 2008
a(39) and beyond from Michael S. Branicky, Sep 07 2024
STATUS
approved