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

A103270 a(n) = (prime(n)+prime(n+k)) mod 4, where k = (prime(n+1)-prime(n))/2.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 2, 0, 2, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 2

Views

Author

Yasutoshi Kohmoto, Jan 27 2005

Keywords

Comments

If {prime(n), prime(n+1)} are twin primes, then a(n) = 2*prime(n)+2 = 0 mod 4.
The number of 2's up to n = 2^k, k >= 1, is (0, 0, 0, 1, 4, 9, 30, 72, 162, 346, 779, 1596, 3333, 6867, 13987, 28229,...). Between n = 2^5 and n = 2^16, the percentage of 2's increases from 12.5% to 43%. - M. F. Hasler, Jun 06 2017

Crossrefs

Cf. A103271.
See A287868 for positions of 2's.

Programs

  • Maple
    a:=proc(n) local k: k:=(ithprime(n+1)-ithprime(n))/2: ithprime(n)+ithprime(n+k) mod 4 end: seq(a(n),n=2..130); # Emeric Deutsch, May 31 2005
  • Mathematica
    Table[Mod[Prime[n]+Prime[n+(Prime[n+1]-Prime[n])/2],4],{n,2,120}] (* Harvey P. Dale, Jun 30 2020 *)
  • PARI
    a(n)=(prime(n+(prime(n+1)-n=prime(n))/2)+n)%4 \\ M. F. Hasler, May 12 2016
    
  • PARI
    {S=0; L=n=1; o=3; forprime(p=4,,S+=(o+prime((-o+o=p)\2+n++))%4;nM. F. Hasler, Jun 06 2017

Extensions

More terms from Emeric Deutsch, May 31 2005

A272356 (Sum_{i=1..n} prime(i)) mod 4.

Original entry on oeis.org

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

Views

Author

M. F. Hasler, Apr 26 2016

Keywords

Comments

Inspired by A103271, prime(n)+prime(n+1) mod 4.

Crossrefs

Programs

  • PARI
    A272356(n,print_all=1,a=Mod(0,4))={n&&forprime(p=2,,a+=p;print_all&&print1(lift(a)",");n--||break);lift(a)}

Formula

a(n) = A007504(n) mod 4.
Showing 1-2 of 2 results.