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.
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
Keywords
Examples
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.
Programs
-
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