OFFSET
1,1
EXAMPLE
1*prime(1) + 2*prime(3) = 12, 1 + 2 = 3 and 12/3 = 4 is an integer and no other strictly increasing sequence of 2 primes <= prime(3) gives a lesser result, so a(2) = 4.
1*prime(3) + 2*prime(5) + 3*prime(6) = 5 + 2*11 + 3*13 = 66, 66/6 = 11 is an integer and no other strictly increasing sequence of 3 primes <= prime(6) gives a lesser result, so a(3) = 11.
PROG
(PARI) is(u)={my(s=0, c=0, n=#u, sc=n*(n+1)/2); for(i=1, n, my(p=prime(u[i])); s+=i*p); s%sc==0}
f(u)={my(s=0, n=#u, vc=vector(n, x, x), sc=n*(n+1)/2, v=[]); if(is(u), for(i=1, #u, v=concat(v, prime(u[i]))); s=v*vc~; return(s/sc)); -1}
find(m=n, n)={my(x=m, sol=[], solmin=-1); forsubset([m, n], p, my(vp=Vec(p)); if(is(vp), my(x=f(vp)); if(solmin==-1, solmin=x); if(solmin>0&&x<solmin, solmin=x)); if(x<vecmin(vp), break)); return(solmin)}
a(n)={my(m=n); x=find(m, n); while(x==-1, m++; x=find(m, n)); return(x)}
CROSSREFS
KEYWORD
nonn
AUTHOR
Jean-Marc Rebert, Jun 16 2023
STATUS
approved