cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

This page as a plain text file.
%I A363702 #68 Sep 06 2023 21:20:53
%S A363702 2,4,11,12,12,12,16,21,24,22,24,31,32,34,41,40,42,44,49,50,52,52,61,
%T A363702 63,62,68,70,75,74,82,88,89,92,92,102,106,106,106,113,118,118,118,125,
%U A363702 127,132,132,141,148,142,150,154,158,158,162,171,175,172,178,181,187
%N 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.
%e A363702 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.
%e A363702 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.
%o A363702 (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}
%o A363702 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}
%o A363702 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)}
%o A363702 a(n)={my(m=n);x=find(m,n); while(x==-1,m++;x=find(m,n)); return(x)}
%Y A363702 Cf. A045345, A050248.
%K A363702 nonn
%O A363702 1,1
%A A363702 _Jean-Marc Rebert_, Jun 16 2023