login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A126084
a(n) = XOR of first n primes.
5
0, 2, 1, 4, 3, 8, 5, 20, 7, 16, 13, 18, 55, 30, 53, 26, 47, 20, 41, 106, 45, 100, 43, 120, 33, 64, 37, 66, 41, 68, 53, 74, 201, 64, 203, 94, 201, 84, 247, 80, 253, 78, 251, 68, 133, 64, 135, 84, 139, 104, 141, 100, 139, 122, 129, 384, 135, 394, 133, 400, 137, 402, 183, 388, 179
OFFSET
0,2
COMMENTS
The values at odd positive indices are even and the values at even positive indices are odd.
Does this sequence contain any zeros for n > 0? Probabilistically, one would expect so; but none in first 10000 terms. - Franklin T. Adams-Watters, Jul 17 2011
None below 1.5 * 10^11: any prime p such that a(pi(p)) = 0 is 43 bits or longer. Heuristic chances that a prime below 2^100 yields 0 are about 45%. Note that an n-bit prime can yield 0 only if a(pi(p)) is odd, where p is the smallest n-bit prime. That is, for n > 1, there are no zeros from pi(2^n) to pi(2^(n+1)) if A007053(n) is even. - Charles R Greathouse IV, Jul 17 2011
LINKS
Franklin T. Adams-Watters, Table of n, a(n) for n = 0..10000
FORMULA
a(0) = 0; a(n) = a(n-1) XOR prime(n).
EXAMPLE
a(4) = 3 because ((2 XOR 3) XOR 5) XOR 7 = (1 XOR 5) XOR 7 = 4 XOR 7 = 3
[Or, in base 2]
((10 XOR 11) XOR 101) XOR 111 = (1 XOR 101) XOR 111 = 100 XOR 111 = 11
MATHEMATICA
Module[{nn=70, prs}, prs=Prime[Range[nn]]; Table[BitXor@@Take[prs, n], {n, 0, nn}]] (* Harvey P. Dale, Jun 23 2016 *)
PROG
(PARI) al(n)=local(m); vector(n, k, m=bitxor(m, prime(k))) /* Produces a vector without a(0) = 0; Franklin T. Adams-Watters, Jul 17 2011 */
(PARI) v=primes(300); for(i=2, #v, v[i]=bitxor(v[i], v[i-1])); concat(0, v) \\ Charles R Greathouse IV, Aug 26 2014
(PARI) q=0; forprime(p=2, 313, print1(q, ", "); q=bitxor(q, p)) /* Klaus Brockhaus, Mar 06 2007; adapted by Rémy Sigrist, Oct 23 2017 */
(Python)
from operator import xor
from functools import reduce
from sympy import primerange, prime
def A126084(n): return reduce(xor, primerange(2, prime(n)+1)) if n else 0 # Chai Wah Wu, Jul 09 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Esko Ranta, Mar 02 2007
EXTENSIONS
More terms from Klaus Brockhaus, Mar 06 2007
Edited by N. J. A. Sloane, Oct 22 2017 (merging old entry A193174 with this)
Edited by Rémy Sigrist, Oct 23 2017
STATUS
approved