login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,2
LINKS
Simon Strandgaard, Visualization
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

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 18:17 EDT 2024. Contains 371962 sequences. (Running on oeis4.)