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
KEYWORD
nonn
AUTHOR
Simon Strandgaard, Dec 05 2020
STATUS
approved