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.

This page as a plain text file.
%I A126084 #26 Jul 10 2022 03:56:59
%S A126084 0,2,1,4,3,8,5,20,7,16,13,18,55,30,53,26,47,20,41,106,45,100,43,120,
%T A126084 33,64,37,66,41,68,53,74,201,64,203,94,201,84,247,80,253,78,251,68,
%U A126084 133,64,135,84,139,104,141,100,139,122,129,384,135,394,133,400,137,402,183,388,179
%N A126084 a(n) = XOR of first n primes.
%C A126084 The values at odd positive indices are even and the values at even positive indices are odd.
%C A126084 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
%C A126084 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
%H A126084 Franklin T. Adams-Watters, <a href="/A126084/b126084.txt">Table of n, a(n) for n = 0..10000</a>
%F A126084 a(0) = 0; a(n) = a(n-1) XOR prime(n).
%e A126084 a(4) = 3 because ((2 XOR 3) XOR 5) XOR 7 = (1 XOR 5) XOR 7 = 4 XOR 7 = 3
%e A126084 [Or, in base 2]
%e A126084 ((10 XOR 11) XOR 101) XOR 111 = (1 XOR 101) XOR 111 = 100 XOR 111 = 11
%t A126084 Module[{nn=70,prs},prs=Prime[Range[nn]];Table[BitXor@@Take[prs,n],{n,0,nn}]] (* _Harvey P. Dale_, Jun 23 2016 *)
%o A126084 (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 */
%o A126084 (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
%o A126084 (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 */
%o A126084 (Python)
%o A126084 from operator import xor
%o A126084 from functools import reduce
%o A126084 from sympy import primerange, prime
%o A126084 def A126084(n): return reduce(xor,primerange(2,prime(n)+1)) if n else 0 # _Chai Wah Wu_, Jul 09 2022
%Y A126084 Cf. A003815, A004767, A112591.
%K A126084 nonn,base
%O A126084 0,2
%A A126084 _Esko Ranta_, Mar 02 2007
%E A126084 More terms from _Klaus Brockhaus_, Mar 06 2007
%E A126084 Edited by _N. J. A. Sloane_, Oct 22 2017 (merging old entry A193174 with this)
%E A126084 Edited by _Rémy Sigrist_, Oct 23 2017