A298817 a(n) is the binary XOR of all n-bit prime numbers.
0, 1, 2, 6, 23, 59, 99, 203, 469, 807, 1615, 3349, 2266, 4576, 14042, 25002, 89193, 131215, 135904, 814531, 885682, 60842, 3969154, 3370892, 6742296, 14350136, 42766902, 97565102, 444197631, 515121776, 2085329975, 2091732354, 7999937231, 14794305847
Offset: 1
Examples
There are two 4-bit primes, namely 11 and 13. a(4) = (11 XOR 13) = 6.
Links
- Lars Blomberg, Table of n, a(n) for n = 1..41
Programs
-
PARI
a(n) = {my(x = 0); for (k=2^(n-1), 2^n-1, if (isprime(k), x = bitxor(x, k));); x;} \\ Michel Marcus, Jan 27 2018
-
Python
from sympy import nextprime n = x = L = 2 print('0', end=',') while L < 27: nextn = nextprime(n) if (nextn ^ n) > n: # if lengths of binary representations are different print(str(x), end=',') x = 0 prevL = L L = len(bin(nextn))-2 for j in range(prevL, L-1): print('0', end=',') n = nextn x ^= n
Extensions
a(30)-a(34) from Lars Blomberg, Nov 10 2018
Comments