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.

A151763 If n is a prime == 1 mod 4 then a(n) = 1, if n is a prime == 3 mod 4 then a(n) = -1, otherwise a(n) = 0.

Original entry on oeis.org

0, 0, -1, 0, 1, 0, -1, 0, 0, 0, -1, 0, 1, 0, 0, 0, 1, 0, -1, 0, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, -1, 0, 1, 0, 0, 0, 0, 0, -1, 0, 0, 0, -1, 0, 1, 0, 0, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0, 0
Offset: 1

Views

Author

N. J. A. Sloane, Jun 22 2009

Keywords

Comments

a(A002145(n)) = -1; a(A065090(n)) = 0; a(A002144(n)) = 1. [Reinhard Zumkeller, Oct 06 2011]

Crossrefs

Cf. A066520 (partial sums).

Programs

  • Haskell
    a151763 n | even n         = 0
              | a010051 n == 1 = 2 - n `mod` 4
              | otherwise      = 0
    -- Reinhard Zumkeller, Oct 06 2011
  • Maple
    a:= proc(n) if n::odd and isprime(n) then 2 - (n mod 4) else 0 fi end proc:
    seq(a(n),n=1..100); # Robert Israel, Aug 22 2014
  • Mathematica
    a[n_] := Which[!PrimeQ[n], 0, m = Mod[n, 4]; m == 1, 1, m == 3, -1, True, 0]; Array[a, 105] (* Jean-François Alcover, Dec 03 2016 *)

Formula

a(n) = (2 - n mod 4) * A010051(n).