cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A126084 a(n) = XOR of first n primes.

Original entry on oeis.org

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

Views

Author

Esko Ranta, Mar 02 2007

Keywords

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

Examples

			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
		

Crossrefs

Programs

  • Mathematica
    Module[{nn=70,prs},prs=Prime[Range[nn]];Table[BitXor@@Take[prs,n],{n,0,nn}]] (* Harvey P. Dale, Jun 23 2016 *)
  • 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

Formula

a(0) = 0; a(n) = a(n-1) XOR prime(n).

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