login
a(n) = n-th prime modulo 4.
25

%I #28 Sep 08 2022 08:44:53

%S 2,3,1,3,3,1,1,3,3,1,3,1,1,3,3,1,3,1,3,3,1,3,3,1,1,1,3,3,1,1,3,3,1,3,

%T 1,3,1,3,3,1,3,1,3,1,1,3,3,3,3,1,1,3,1,3,1,3,1,3,1,1,3,1,3,3,1,1,3,1,

%U 3,1,1,3,3,1,3,3,1,1,1,1,3,1,3,1,3,3,1,1,1,3,3,3,3,3,3,3,1,1,3,1,3,1,3,1,3

%N a(n) = n-th prime modulo 4.

%C Except for the first term, A100672(n) = (A039702(n)-1)/2 = parity of A005097. - _Jeremy Gardiner_, May 17 2008

%H Nathaniel Johnston, <a href="/A039702/b039702.txt">Table of n, a(n) for n = 1..10000</a>

%p seq(ithprime(n) mod 4, n=1..105); # _Nathaniel Johnston_, Jun 29 2011

%t Table[Mod[Prime[n], 4], {n, 105}] (* _Nathaniel Johnston_, Jun 29 2011 *)

%t Mod[Prime[Range[100]], 4] (* _Vincenzo Librandi_, May 06 2014 *)

%o (Haskell)

%o a039702 = (`mod` 4) . a000040 -- _Reinhard Zumkeller_, Feb 20 2012

%o (PARI) a(n)=prime(n)%4 \\ _Charles R Greathouse IV_, Jun 13 2013

%o (Magma) [p mod 4: p in PrimesUpTo(500)]; // _Vincenzo Librandi_, May 06 2014

%Y Cf. A000040, A039701, A039703-A039706, A100672, A005097, A038194, A007652, A039709-A039715.

%K nonn,easy

%O 1,1

%A _Clark Kimberling_