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.

A267135 a(n) = n minus the number of primes of form 4m + 1 that are less than n-th prime of form 4m + 3.

Original entry on oeis.org

1, 1, 2, 1, 2, 2, 1, 2, 2, 2, 3, 3, 4, 2, 3, 2, 3, 3, 3, 3, 4, 4, 4, 3, 4, 5, 6, 5, 5, 5, 5, 4, 4, 5, 4, 4, 3, 4, 4, 5, 2, 2, 2, 3, 1, 2, 3, 4, 5, 6, 7, 6, 6, 6, 6, 6, 6, 6, 5, 6, 6, 7, 7, 5, 6, 5, 6, 6, 7, 8, 5, 4, 4, 5, 5, 4, 5, 4, 5, 6, 7, 8, 6, 6, 7, 7, 8, 6, 6, 6, 6, 6, 6, 7, 6, 5, 5, 5, 6, 6
Offset: 1

Views

Author

Gionata Neri, Jan 10 2016

Keywords

Comments

a(25191) = -3 is the first negative term. - Robert Israel, Jan 12 2016

Crossrefs

Programs

  • Maple
    N:= 10000: # to use primes up to N P1:= select(isprime, [seq(i,i=1..N,4)]):
    P3:= select(isprime, [seq(i,i=3..N,4)]):
    V:= Vector(N):
    for n from 2 to nops(P1) do
      V[P1[n-1]..P1[n]-1]:=n-1
    od:
    V[P1[nops(P1)]..N]:= nops(P1);
    seq(n - V[P3[n]],n=1..nops(P3)); # Robert Israel, Jan 11 2016
  • Mathematica
    nn = 10000;
    P1 = Select[Range[1, nn, 4], PrimeQ];
    P3 = Select[Range[3, nn, 4], PrimeQ];
    V = Table[0, nn];
    For[n = 2, n <= Length[P1], n++,
      V[[P1[[n-1]] ;; P1[[n]]-1]] = n-1
    ];
    V[[P1[[Length[P1]]] ;; nn]] = Length[P1];
    Table[n - V[[P3[[n]]]], {n, 1, Length[P3]}] (* Jean-François Alcover, Sep 18 2018, after Robert Israel *)