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.

A038377 Number of odd nonprimes <= (2n+1)^2.

Original entry on oeis.org

1, 2, 5, 11, 20, 32, 47, 66, 85, 110, 137, 167, 200, 237, 276, 320, 365, 414, 467, 522, 579, 643, 708, 777, 845, 924, 997, 1080, 1169, 1255, 1343, 1437, 1536, 1637, 1741, 1847, 1961, 2075, 2187, 2311, 2435, 2560, 2691, 2826, 2962, 3104, 3249, 3393, 3543
Offset: 0

Views

Author

Keywords

Examples

			a(2) = 5 because there are 5 odd nonprimes that are not exceeding (2*2+1)^2 = 25: 1, 9, 15, 21 and 25.
		

Crossrefs

Programs

  • Mathematica
    nn=20001; With[{onps=Complement[Range[1,nn,2],Prime[Range[PrimePi[nn+1]]]]}, Table[Count[onps,?(#<=(2n+1)^2&)],{n,0,60}]]  (* _Harvey P. Dale, Apr 13 2011 *)
    a[n_] := 2*n^2 + 2*n + 2 - PrimePi[(2*n + 1)^2]; a[0] = 1; Array[a, 61, 0] (* Amiram Eldar, Sep 06 2024 *)
  • PARI
    a(n) = if(n == 0, 1, 2*n^2 + 2*n + 2 - primepi((2*n + 1)^2)); \\ Amiram Eldar, Sep 06 2024

Formula

a(n) = A037040(n) + 1.
For n>=1, a(n) = 2n^2 + 2n + 2 - PrimePi((2n+1)^2) = A051890(n+1) - A000720((2n+1)^2). - Zak Seidov, Mar 03 2008

Extensions

Offset corrected by Amiram Eldar, Sep 06 2024