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.

A364879 a(n) is the smallest number k such that (sum of composites <= k) / (sum of primes <= k) >= n.

This page as a plain text file.
%I A364879 #18 Sep 11 2023 01:47:14
%S A364879 2,6,10,28,126,520,1394,4440,11765,35702,98202,271718,736814,2012631,
%T A364879 5478367,14867499,40448112,109944053,298170203,810416222,2200884471,
%U A364879 5980529528
%N A364879 a(n) is the smallest number k such that (sum of composites <= k) / (sum of primes <= k) >= n.
%C A364879 a(n)+1 is a prime for n = 0, 1, 2, 3, 4, 5, and 7 (thus, for n = 1, 2, 3, 4, 5, and 7, a(n) is the last of a run of consecutive composites), but not for n = 6, nor for any n in 8..16.
%C A364879 For n > 0, a(n) is at least the n-th in a run of consecutive composites. a(15) is the 58th in a run of 71 consecutive composites.
%F A364879 a(n) = min {k : (Sum_{c<=k, c composite} c)/(Sum_{p<=k, p prime} p) >= n}.
%F A364879 a(n) = min {k>1 : k(k+1)-1>=2*A034387(k)*(n+1)}. - _Chai Wah Wu_, Sep 10 2023
%e A364879 Let Sp(k) and Sc(k) be the sums of the primes <= k and the composites <= k, respectively. Then the sums and ratios begin as follows:
%e A364879 .
%e A364879    k | Sp(k) | Sc(k) | Sc(k)/Sp(k)
%e A364879   ---+-------+-------+------------
%e A364879    1 |     0 |     0 | (undefined)
%e A364879    2 |     2 |     0 |  0/2  = 0         so a(0) =  2
%e A364879    3 |     5 |     0 |  0/5  = 0
%e A364879    4 |     5 |     4 |  4/5  = 0.8
%e A364879    5 |    10 |     4 |  4/10 = 0.4
%e A364879    6 |    10 |    10 | 10/10 = 1         so a(1) =  6
%e A364879    7 |    17 |    10 | 10/17 = 0.5882...
%e A364879    8 |    17 |    18 | 18/17 = 1.0588...
%e A364879    9 |    17 |    27 | 27/17 = 1.5882...
%e A364879   10 |    17 |    37 | 37/17 = 2.1764... so a(2) = 10
%o A364879 (Python)
%o A364879 from itertools import count
%o A364879 from sympy import isprime
%o A364879 def A364879(n):
%o A364879     c, cn, m = 0, 0, n+1<<1
%o A364879     for k in count(2):
%o A364879         if isprime(k):
%o A364879             c += k
%o A364879             cn += k*m
%o A364879         if k*(k+1)-1 >= cn:
%o A364879             return k # _Chai Wah Wu_, Sep 10 2023
%Y A364879 Cf. A000040, A002808, A007504, A034387, A053767, A101256.
%K A364879 nonn,more
%O A364879 0,1
%A A364879 _Jon E. Schoenfield_, Sep 10 2023
%E A364879 a(17)-a(21) from _Chai Wah Wu_, Sep 10 2023