A346512 a(n) = bitwise XOR of decimal digits of primes.
2, 3, 5, 7, 0, 2, 6, 8, 1, 11, 2, 4, 5, 7, 3, 6, 12, 7, 1, 6, 4, 14, 11, 1, 14, 0, 2, 6, 8, 3, 4, 3, 5, 11, 12, 5, 3, 4, 0, 5, 15, 8, 9, 11, 15, 1, 2, 3, 7, 9, 2, 8, 7, 6, 0, 7, 13, 4, 2, 11, 9, 8, 4, 3, 1, 5, 1, 7, 0, 14, 5, 15, 2, 7, 13, 8, 2, 13, 5, 13, 12
Offset: 1
Examples
a(10) = 2 XOR 9 = 11 as prime(10) = 29.
Links
- Mia Boudreau, Table of n, a(n) for n = 1..10000
- Wikipedia, Bitwise operation
Crossrefs
Programs
-
Maple
b:= l-> `if`(l=[], 0, Bits[Xor](l[1], b(subsop(1=[][], l)))): a:= n-> b(convert(ithprime(n), base, 10)): seq(a(n), n=1..82); # Alois P. Heinz, Jul 21 2021
-
Mathematica
Table[BitXor @@ IntegerDigits[Prime[n]], {n, 1, 100}] (* Amiram Eldar, Jul 21 2021 *)
-
PARI
a(n) = my(d=digits(prime(n)), k=0); for (i=1, #d, k= bitxor(k, d[i])); k; \\ Michel Marcus, Jul 21 2021
-
Sage
def XOR(a, b): return a ^^ b [reduce(XOR, map(lambda x: int(x), str(p))) for p in (0..100) if p in Primes()]