login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A363702
Let m be the least integer for which there exists a strictly increasing sequence u of n integers in {1..m} such that x = (2 * Sum_{k=1..n} k*prime(u(k))) / (n*(n+1)) is an integer. a(n) is the least x, or -1 if no such integer x exists.
0
2, 4, 11, 12, 12, 12, 16, 21, 24, 22, 24, 31, 32, 34, 41, 40, 42, 44, 49, 50, 52, 52, 61, 63, 62, 68, 70, 75, 74, 82, 88, 89, 92, 92, 102, 106, 106, 106, 113, 118, 118, 118, 125, 127, 132, 132, 141, 148, 142, 150, 154, 158, 158, 162, 171, 175, 172, 178, 181, 187
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
Sequence in context: A218643 A300375 A075488 * A136995 A136993 A136992
KEYWORD
nonn
AUTHOR
Jean-Marc Rebert, Jun 16 2023
STATUS
approved