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-3 of 3 results.

A383037 a(n) is the excess of composites over primes in the first n odd positive integers.

Original entry on oeis.org

0, -1, -2, -3, -2, -3, -4, -3, -4, -5, -4, -5, -4, -3, -4, -5, -4, -3, -4, -3, -4, -5, -4, -5, -4, -3, -4, -3, -2, -3, -4, -3, -2, -3, -2, -3, -4, -3, -2, -3, -2, -3, -2, -1, -2, -1, 0, 1, 0, 1, 0, -1, 0, -1, -2, -1, -2, -1, 0, 1, 2, 3, 4, 3, 4, 3, 4, 5, 4, 3, 4
Offset: 1

Views

Author

Felix Huber, Apr 19 2025

Keywords

Examples

			Of the first 5 odd positive integers (1, 3, 5, 7, 9), one (9) is a composite and three (3, 5, 7) are primes, so a(5) = 1 - 3 = -2.
		

Crossrefs

Programs

  • Maple
    A383037:=n->n-NumberTheory:-pi(2*n)*2+1;seq(A383037(n),n=1..71);
  • Mathematica
    a[n_]:=n - 2*PrimePi[2*n] + 1; Array[a,71] (* Stefano Spezia, Apr 20 2025 *)

Formula

a(n) = n - 2*pi(2*n) + 1.
a(n) = A210469(n) - pi(2*n) + 1 = A210469(n) - A000720(2*n) + 1 = for n > 1.
a(n) = A118777(2*n-1) - n + 1 for n > 1.
a(n) = A097454(2*n-1) - n + 2 for n > 1.
a(n) = A072731(2*n-1) - n + 3 for n > 1.

A224710 The number of unordered partitions {a,b} of 2n-1 such that a and b are composite.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 4, 5, 5, 5, 6, 7, 7, 8, 8, 8, 9, 9, 10, 11, 11, 12, 13, 13, 13, 14, 15, 15, 16, 16, 16, 17, 18, 18, 19, 19, 20, 21, 21, 22, 23, 24, 24, 25, 25, 25, 26, 26, 26, 27, 27, 28, 29, 30, 31, 32, 33, 33, 34, 34, 35, 36, 36
Offset: 1

Views

Author

J. Stauduhar, Apr 16 2013

Keywords

Comments

Except for the initial terms, the same sequence as A210469.

Examples

			n=7: 13 has a unique representation as the sum of two composite numbers, namely 13 = 4+9, so a(7)=1.
		

Crossrefs

Subsequence of A224708. Cf. A210469.

Programs

  • Mathematica
    Table[Length@ Select[IntegerPartitions[2 n - 1, {2}] /. n_Integer /; ! CompositeQ@ n -> Nothing, Length@ # == 2 &], {n, 71}] (* Version 10.2, or *)
    Table[If[n == 1, 0, n - 2 - PrimePi[2 n - 4]], {n, 71}] (* Michael De Vlieger, May 03 2016 *)

Formula

a(n) = n - 2 - primepi(2n-4) for n>1. - Anthony Browne, May 03 2016
a(A104275(n+2) + 1) = n. - Anthony Browne, May 25 2016

A308754 a(0) = 0, a(n) = a(n-1) + 1 if 2*n + 3 is prime, otherwise a(n) = a(n-1).

Original entry on oeis.org

0, 1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 7, 7, 8, 9, 9, 9, 10, 10, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 16, 16, 16, 17, 17, 18, 19, 19, 19, 20, 20, 21, 21, 21, 22, 22, 22, 22, 23, 23, 24, 25, 25, 26, 27, 27, 28, 28, 28, 28, 28, 28, 28, 29, 29, 30, 30, 30, 31
Offset: 0

Views

Author

Keywords

Comments

It appears that A000040(a(n)) ~ 2*n as n tends to infinity. (See Mar 12 2012 note from Vladimir Shevelev in A060308.)

Examples

			a(0) = 0 (by definition).
a(1) = 1 = a(0) + 1, because 2*1 + 3 is prime;
a(2) = 2 = a(1) + 1, because 2*2 + 3 is prime;
a(3) = 2 = a(2),     because 2*3 + 3 is not prime;
a(4) = 3 = a(3) + 1, because 2*4 + 3 is prime.
		

Crossrefs

Programs

  • BASIC
    ' p(n) contains the prime sequence except for 2. p(0)=3
    ' output in the a(n) sequence for 0 <= n <= maxterm
    ip = -1
    For n = 0 To maxterm
       If (2 * n + 3) = p(ip+1) Then
          ip = ip + 1
       End If
       a(n) = ip
    Next n
    
  • Magma
    [#PrimesUpTo(2*n + 4) - 2: n in [0..80] ]; // Vincenzo Librandi, Aug 01 2019
  • Mathematica
    a[0] = 0; a[n_] := a[n] = a[n - 1] + Boole@PrimeQ[2 n + 3]; Array[a, 100, 0] (* Amiram Eldar, Jul 06 2019 *)

Formula

a(n) = a(n-1) + A101264(n+1), n > 0.
a(n) = A000720(2 * (n+2)) - 2.
a(n) = A099801(n+1) - 2.
a(n) = n - A210469(n+2).
A000040(a(n) + 2) = A060265(n+2).
A000040(a(n) + 2) = A060308(n+2).
A000040(a(n) + 2) = A085090(n+2), if 2*n + 3 is prime, otherwise 0.
Showing 1-3 of 3 results.