login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A339448
a(n) = (prime(n) - a(n-1)) mod 3; a(0)=0.
1
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,2
EXAMPLE
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.
MATHEMATICA
a[0]=0; a[n_]:=Mod[Prime[n]-a[n-1], 3]; Table[a[n], {n, 0, 85}] (* Stefano Spezia, Dec 05 2020 *)
PROG
(Ruby) require 'prime'
values = [0]
Prime.first(50).each do |prime|
values << (prime-values[-1]) % 3
end
p values
CROSSREFS
Cf. A008347.
Sequence in context: A101979 A369241 A308061 * A060582 A060450 A180918
KEYWORD
nonn
AUTHOR
Simon Strandgaard, Dec 05 2020
STATUS
approved