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.

Showing 1-4 of 4 results.

A101203 a(n) = sum of nonprimes <= n.

Original entry on oeis.org

0, 1, 1, 1, 5, 5, 11, 11, 19, 28, 38, 38, 50, 50, 64, 79, 95, 95, 113, 113, 133, 154, 176, 176, 200, 225, 251, 278, 306, 306, 336, 336, 368, 401, 435, 470, 506, 506, 544, 583, 623, 623, 665, 665, 709, 754, 800, 800, 848, 897, 947, 998, 1050, 1050, 1104, 1159, 1215
Offset: 0

Views

Author

Reinhard Zumkeller, Jan 23 2005

Keywords

Crossrefs

Partial sums of A191558.

Programs

  • Haskell
    a101203 n = a101203_list !! (n-1)
    a101203_list = scanl (+) 0 $ zipWith (*) [1..] $ map (1 -) a010051_list
    -- Reinhard Zumkeller, Oct 10 2013
  • Mathematica
    Accumulate[Table[If[PrimeQ[n],0,n],{n,0,60}]] (* Harvey P. Dale, Oct 02 2020 *)
  • PARI
    my(s=0); for(k=0,100,if(!isprime(k),s+=k);print1(s", ")); \\ Cino Hilliard, Feb 04 2006
    

Formula

a(n) = A000217(n) - A034387(n) = A101256(n) + 1.

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

Original entry on oeis.org

2, 6, 10, 28, 126, 520, 1394, 4440, 11765, 35702, 98202, 271718, 736814, 2012631, 5478367, 14867499, 40448112, 109944053, 298170203, 810416222, 2200884471, 5980529528
Offset: 0

Views

Author

Jon E. Schoenfield, Sep 10 2023

Keywords

Comments

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.
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.

Examples

			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:
.
   k | Sp(k) | Sc(k) | Sc(k)/Sp(k)
  ---+-------+-------+------------
   1 |     0 |     0 | (undefined)
   2 |     2 |     0 |  0/2  = 0         so a(0) =  2
   3 |     5 |     0 |  0/5  = 0
   4 |     5 |     4 |  4/5  = 0.8
   5 |    10 |     4 |  4/10 = 0.4
   6 |    10 |    10 | 10/10 = 1         so a(1) =  6
   7 |    17 |    10 | 10/17 = 0.5882...
   8 |    17 |    18 | 18/17 = 1.0588...
   9 |    17 |    27 | 27/17 = 1.5882...
  10 |    17 |    37 | 37/17 = 2.1764... so a(2) = 10
		

Crossrefs

Programs

  • Python
    from itertools import count
    from sympy import isprime
    def A364879(n):
        c, cn, m = 0, 0, n+1<<1
        for k in count(2):
            if isprime(k):
                c += k
                cn += k*m
            if k*(k+1)-1 >= cn:
                return k # Chai Wah Wu, Sep 10 2023

Formula

a(n) = min {k : (Sum_{c<=k, c composite} c)/(Sum_{p<=k, p prime} p) >= n}.
a(n) = min {k>1 : k(k+1)-1>=2*A034387(k)*(n+1)}. - Chai Wah Wu, Sep 10 2023

Extensions

a(17)-a(21) from Chai Wah Wu, Sep 10 2023

A383641 a(n) is the difference between the sum of even composites and the sum of the odd composites in the first n positive integers.

Original entry on oeis.org

0, 0, 0, 4, 4, 10, 10, 18, 9, 19, 19, 31, 31, 45, 30, 46, 46, 64, 64, 84, 63, 85, 85, 109, 84, 110, 83, 111, 111, 141, 141, 173, 140, 174, 139, 175, 175, 213, 174, 214, 214, 256, 256, 300, 255, 301, 301, 349, 300, 350, 299, 351, 351, 405, 350, 406, 349, 407, 407
Offset: 1

Views

Author

Felix Huber, May 08 2025

Keywords

Examples

			Of the first 9 positive integers, 4, 6, and 8 are even composites and 9 is an odd composite, so a(9) = 4 + 6 + 8 - 9 = 9.
		

Crossrefs

Programs

  • Maple
    A383641:=n->`if`(n=1,0,floor((n-2)/2)-n*(n mod 2)+add(ithprime(i),i=2..NumberTheory:-pi(n)));seq(A383641(n),n=1..59);
  • Mathematica
    lim=59;cn=Select[Range[lim],CompositeQ];a[n_]:=Total[Select[cn,EvenQ[#]&&#<=n&]]-Total[Select[cn,OddQ[#]&&#<=n&]];Array[a,lim] (* James C. McMahon, May 14 2025 *)

Formula

a(n) = floor((n-2)/2) - n*(n mod 2) + Sum_{i=2..pi(n)} prime(i) for n > 1.
a(n) = A004526(n) - A193356(n) - A010701(n) + A034387(A000720(n)) for n > 1.
a(n) = Sum_{i=1..n} ((-1)^i*i*A066247(i)).

A073700 a(1) = 1, a(n) = Floor[(Sum of composite numbers up to n)/(Sum of primes up to n)].

Original entry on oeis.org

1, 0, 0, 0, 0, 1, 0, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 2, 2, 3, 3, 3, 3, 3, 3, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 2, 2, 3, 3, 3, 3, 2, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
Offset: 1

Views

Author

Amarnath Murthy, Aug 12 2002

Keywords

Comments

Though the sequence is not monotonically increasing the average value increases and a derived sequence could be the smallest value of k for which a(k) = n.
Note 1 is neither composite nor prime.

Examples

			a(10) = floor((4+6+8+9+10)/(2+3+5+7)) = floor(37/17) = 2.
		

Crossrefs

Programs

  • Maple
    a := 0:b := 0:for i from 2 to 300 do if isprime(i) then a := a+i: else b := b+i:fi: c[i] := floor(b/a):od:c[1] := 1:seq(c[j],j=1..300);
  • Mathematica
    Module[{nn=110,pr,comp},pr=Prime[Range[PrimePi[nn]]];comp=Complement[Range[ 2,nn], pr]; Join[{1}, Table[Floor[Total[Select[comp,#<=n&]]/Total[Select[pr,#<=n&]]],{n,2,nn}]]] (* Harvey P. Dale, Feb 22 2013 *)
    Join[{1}, Table[t1 = Select[x = Range[n], PrimeQ]; Floor[Divide @@ Plus @@@ {Rest[Complement[x, t1]], t1}], {n, 2, 105}]] (* Jayanta Basu, Jul 07 2013 *)

Formula

a(n) = floor(A101256(n)/A034387(n)). - Jason Yuen, Aug 20 2024

Extensions

More terms from Sascha Kurz, Aug 15 2002
Showing 1-4 of 4 results.