login
A340867
a(n) = (prime(n) - a(n-1)) mod 4; a(0)=0.
1
0, 2, 1, 0, 3, 0, 1, 0, 3, 0, 1, 2, 3, 2, 1, 2, 3, 0, 1, 2, 1, 0, 3, 0, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 3, 2, 1, 0, 3, 0, 1, 2, 3, 0, 1, 0, 3, 0, 3, 0, 1, 0, 3, 2, 1, 0, 3, 2, 1, 0, 1, 2, 3, 0, 3, 2, 3, 0, 1, 2, 3, 2, 1, 2, 3, 0, 3, 2, 3, 2, 3, 0, 1, 2, 3, 0
OFFSET
0,2
LINKS
FORMULA
a(n) = A008347(n) mod 4.
EXAMPLE
a(1) = ( 2 - 0) mod 4 = 2,
a(2) = ( 3 - 2) mod 4 = 1,
a(3) = ( 5 - 1) mod 4 = 0,
a(4) = ( 7 - 0) mod 4 = 3,
a(5) = (11 - 3) mod 4 = 0.
MATHEMATICA
a[0] = 0; a[n_] := a[n] = Mod[Prime[n] - a[n - 1], 4]; Array[a, 100, 0] (* Amiram Eldar, Jan 30 2021 *)
PROG
(Ruby) require 'prime'
values = [0]
Prime.first(50).each do |prime|
values << (prime-values[-1]) % 4
end
p values
CROSSREFS
Sequence in context: A159813 A157409 A245960 * A178616 A165252 A371954
KEYWORD
nonn
AUTHOR
Simon Strandgaard, Jan 24 2021
STATUS
approved