OFFSET
1,1
COMMENTS
If n > 2 and prime(n) is a Mersenne prime then a(n) = 1. Proof: prime(n) = 2^p - 1 for some odd prime p, so prime(n) = 2*4^((p-1)/2) - 1 == 2 - 1 = 1 (mod 3). - Santi Spadaro, May 03 2002; corrected and simplified by Dean Hickerson, Apr 20 2003
Except for n = 2, a(n) is the smallest number k > 0 such that 3 divides prime(n)^k - 1. - T. D. Noe, Apr 17 2003
a(n) <> 0 for n <> 2; a(A049084(A003627(n))) = 2; a(A049084(A002476(n))) = 1; A134323(n) = (1 - 0^a(n)) * (-1)^(a(n)+1). - Reinhard Zumkeller, Oct 21 2007
Probability of finding 1 (or 2) in this sequence is 1/2. This follows from the Prime Number Theorem in arithmetic progressions. Examples: There are 4995 1's in terms (10^9 +1) to (10^9+10^4); there are 10^9/2-1926 1's in the first 10^9 terms. - Jerzy R Borysowicz, Mar 06 2022
LINKS
Nathaniel Johnston, Table of n, a(n) for n = 1..10000
MAPLE
seq(ithprime(n) mod 3, n=1..105); # Nathaniel Johnston, Jun 29 2011
MATHEMATICA
Table[Mod[Prime[n], 3], {n, 100}]
PROG
(Haskell)
a039701 = (`mod` 3) . a000040
a039701_list = map (`mod` 3) a000040_list
-- Reinhard Zumkeller, Nov 16 2012
(Magma) [p mod(3): p in PrimesUpTo(500)]; // Vincenzo Librandi, May 06 2014
(PARI) primes(100)%3 \\ Charles R Greathouse IV, May 06 2014
CROSSREFS
Cf. A120326 (partial sums).
KEYWORD
nonn,easy
AUTHOR
STATUS
approved