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.

A339185 a(n) is the least prime p such that the sum of n consecutive primes starting with p has exactly n prime factors, counted with multiplicity, or 0 if no such p exists.

This page as a plain text file.
%I A339185 #12 Nov 29 2020 21:57:04
%S A339185 2,0,137,5,41,109,4253,569,23057,821,405863,9013,1049173,73009,
%T A339185 9742969,188017,382355863,236527,3198295691,1843111,21640201361,
%U A339185 7600499,376724314301,33177461,1974496270177,305216017,85571500507397,148597987,145412255489161,951267841,2609815945304401,1140850357,24575914221842531
%N A339185 a(n) is the least prime p such that the sum of n consecutive primes starting with p has exactly n prime factors, counted with multiplicity, or 0 if no such p exists.
%C A339185 Conjecture: Such p exists for every n > 2.
%F A339185 A339269(n) = A143121(a(n)+n, a(n)).
%e A339185 a(3)=137 because the sum of 3 consecutive primes starting with 137 is 137+139+149=425=5^2*7 is the product of 3 primes counting multiplicity, and 137 is the least prime with this property.
%p A339185 sumofconsecprimes:= proc(x,n)
%p A339185   local P,k,p,q,t;
%p A339185   P:= nextprime(floor(x/n));
%p A339185   p:= P; q:= P;
%p A339185   for k from 1 to n-1 do
%p A339185     if k::even or q = 2 then p:= nextprime(p); P:= P,p;
%p A339185     else q:= prevprime(q); P:= q,P;
%p A339185     fi
%p A339185   od;
%p A339185   P:= [P];
%p A339185   t:= convert(P,`+`);
%p A339185   if t = x then return P fi;
%p A339185   if t > x then
%p A339185     while t > x do
%p A339185       if q = 2 then return false fi;
%p A339185       q:= prevprime(q);
%p A339185       t:= t + q - p;
%p A339185       P:= [q, op(P[1..-2])];
%p A339185       p:= P[-1];
%p A339185       if t = x then return P fi;
%p A339185     od
%p A339185   else
%p A339185     while t < x do
%p A339185       p:= nextprime(p);
%p A339185       t:= t + p - q;
%p A339185       P:= [op(P[2..-1]),p];
%p A339185       q:= P[1];
%p A339185       if t = x then return P fi;
%p A339185     od
%p A339185   fi;
%p A339185   false
%p A339185 end proc:
%p A339185 children:= proc(r) local L,x,p,q,t,R;
%p A339185   x:= r[1];
%p A339185   L:= r[2];
%p A339185   t:= L[-1];
%p A339185   p:= t[1]; q:= nextprime(p);
%p A339185   if t[2]=1 then t:= [q,1];
%p A339185   else t:= [p,t[2]-1],[q,1]
%p A339185   fi;
%p A339185   R:= [x*q/p,[op(L[1..-2]),t]];
%p A339185   if nops(L) >= 2 then
%p A339185     p:= L[-2][1];
%p A339185     q:= L[-1][1];
%p A339185     if L[-2][2]=1 then t:= [q,L[-1][2]+1]
%p A339185     else t:= [p,L[-2][2]-1],[q,L[-1][2]+1]
%p A339185     fi;
%p A339185     R:= R, [x*q/p, [op(L[1..-3]),t]]
%p A339185   fi;
%p A339185   [R]
%p A339185 end proc:
%p A339185 f:= proc(n) local Q,t,x,v;
%p A339185       uses priqueue;
%p A339185       initialize(Q);
%p A339185       if n::even then insert([-2^n,[[2,n]]],Q)
%p A339185       else insert([-3^n,[[3,n]]],Q)
%p A339185       fi;
%p A339185       do
%p A339185         t:= extract(Q);
%p A339185         x:= -t[1];
%p A339185         v:= sumofconsecprimes(x,n);
%p A339185         if v <> false then return v[1] fi;
%p A339185         for t in children(t) do insert(t,Q) od;
%p A339185       od
%p A339185    end proc:
%p A339185 f(1):= 2:
%p A339185 f(2):= 0:
%p A339185 map(f, [$1..34]);
%Y A339185 Cf. A001222, A143121, A339269.
%K A339185 nonn
%O A339185 1,1
%A A339185 _J. M. Bergot_ and _Robert Israel_, Nov 26 2020