login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A126084 a(n) = XOR of first n primes. 5

%I #26 Jul 10 2022 03:56:59

%S 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 33,64,37,66,41,68,53,74,201,64,203,94,201,84,247,80,253,78,251,68,

%U 133,64,135,84,139,104,141,100,139,122,129,384,135,394,133,400,137,402,183,388,179

%N a(n) = XOR of first n primes.

%C The values at odd positive indices are even and the values at even positive indices are odd.

%C 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 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 Franklin T. Adams-Watters, <a href="/A126084/b126084.txt">Table of n, a(n) for n = 0..10000</a>

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

%e a(4) = 3 because ((2 XOR 3) XOR 5) XOR 7 = (1 XOR 5) XOR 7 = 4 XOR 7 = 3

%e [Or, in base 2]

%e ((10 XOR 11) XOR 101) XOR 111 = (1 XOR 101) XOR 111 = 100 XOR 111 = 11

%t Module[{nn=70,prs},prs=Prime[Range[nn]];Table[BitXor@@Take[prs,n],{n,0,nn}]] (* _Harvey P. Dale_, Jun 23 2016 *)

%o (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 (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 (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 (Python)

%o from operator import xor

%o from functools import reduce

%o from sympy import primerange, prime

%o def A126084(n): return reduce(xor,primerange(2,prime(n)+1)) if n else 0 # _Chai Wah Wu_, Jul 09 2022

%Y Cf. A003815, A004767, A112591.

%K nonn,base

%O 0,2

%A _Esko Ranta_, Mar 02 2007

%E More terms from _Klaus Brockhaus_, Mar 06 2007

%E Edited by _N. J. A. Sloane_, Oct 22 2017 (merging old entry A193174 with this)

%E Edited by _Rémy Sigrist_, Oct 23 2017

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 02:46 EDT 2024. Contains 371917 sequences. (Running on oeis4.)