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.

A339448 a(n) = (prime(n) - a(n-1)) mod 3; a(0)=0.

Original entry on oeis.org

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

Views

Author

Simon Strandgaard, Dec 05 2020

Keywords

Examples

			a(1) = ( 2 - 0) mod 3 = 2,
a(2) = ( 3 - 2) mod 3 = 1,
a(3) = ( 5 - 1) mod 3 = 1,
a(4) = ( 7 - 1) mod 3 = 0,
a(5) = (11 - 0) mod 3 = 2.
		

Crossrefs

Cf. A008347.

Programs

  • Mathematica
    a[0]=0; a[n_]:=Mod[Prime[n]-a[n-1],3]; Table[a[n],{n,0,85}] (* Stefano Spezia, Dec 05 2020 *)
  • Ruby
    require 'prime'
    values = [0]
    Prime.first(50).each do |prime|
        values << (prime-values[-1]) % 3
    end
    p values