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.

A385997 a(n) is the smallest k such that the sum of the first k primes has exactly n prime factors, counting multiplicity.

This page as a plain text file.
%I A385997 #35 Sep 02 2025 04:11:56
%S A385997 1,3,5,9,17,11,103,119,475,237,2661,1481,3045,1567,22019,34907,24995,
%T A385997 28173,4915,269225,214183,927571,1085315,9724983,2567053,4620383,
%U A385997 8827803,38175467,37167809,98773463,153124063,257222427,370283099,24322477,592786617
%N A385997 a(n) is the smallest k such that the sum of the first k primes has exactly n prime factors, counting multiplicity.
%C A385997 a(n) is the smallest k such that A001222(A007504(k)) = A102862(k) = n.
%C A385997 a(34) = 24322477. - _Robert Israel_, Jul 29 2025
%e A385997 a(2) = 3, because the sum of the first three primes 2 + 3 + 5 = 10 = 2*5 has exactly 2 prime factors. The sums of the first 1 or 2 primes (2 or 2 + 3 = 5) have only one prime factor.
%e A385997 a(5) = 17, because the sum of the first 17 primes (440 = 2^3*5*11) has exactly 5 prime factors. The sums of the first 1, 2, ..., 16 primes have either fewer or more than 5 prime factors.
%p A385997 M:= 29: # for a(1) .. a(M)
%p A385997 V:= Vector(M):
%p A385997 t:= 0: p:= 1: count:= 0:
%p A385997 for i from 1 while count < M do
%p A385997   p:= nextprime(p);
%p A385997   t:= t + p;
%p A385997   v:= numtheory:-bigomega(t);
%p A385997   if v <= M and V[v] = 0 then V[v]:= i; count:= count+1 fi
%p A385997 od:
%p A385997 convert(V,list); # _Robert Israel_, Jul 29 2025
%t A385997 a[n_]:=Module[{k=1,ps=0},Until[PrimeOmega[ps]==n,ps=ps+Prime[k];k++];k-1];Array[a,20] (* _James C. McMahon_, Aug 05 2025 *)
%o A385997 (Python)
%o A385997 from itertools import count
%o A385997 from sympy import factorint, nextprime
%o A385997 def A385997(n):
%o A385997     p, c = 2, 0
%o A385997     for k in count(1):
%o A385997         c += p
%o A385997         if sum(factorint(c).values())==n:
%o A385997             return k
%o A385997         p = nextprime(p) # _Chai Wah Wu_, Aug 08 2025
%Y A385997 Cf. A000040, A001222, A007504, A102862.
%K A385997 nonn,more,changed
%O A385997 1,2
%A A385997 _Felix Huber_, Jul 27 2025
%E A385997 a(23)-a(30) from _Robert Israel_, Jul 29 2025
%E A385997 a(31) from _Sean A. Irvine_, Aug 05 2025
%E A385997 a(32)-a(34) from _Chai Wah Wu_, Aug 08 2025
%E A385997 a(35) from _Chai Wah Wu_, Sep 01 2025