OFFSET
1,2
COMMENTS
When represented in binary, this sequence represents the uncommon bits in two consecutive prime numbers.
a(n) = 2 for indices of the lesser twin primes of the form 4k + 1, A071695. - Michel Marcus, Apr 17 2020
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
EXAMPLE
a(2) = 6 ; since prime(2) = 3, which is 11 in binary, prime(3) = 5, which is 101 in binary; and 011 XOR 101 = 110, which is 6 in decimal.
MAPLE
A112591 := proc(n) local ndual, n2dual, nxor, i ; ndual := convert(ithprime(n), base, 2) ; n2dual := convert(ithprime(n+1), base, 2) ; nxor := [] ; i := 1 ; while i <= nops(ndual) do nxor := [op(nxor), abs(op(i, ndual)-op(i, n2dual)) ] ; i := i+1 ; od ; while i <= nops(n2dual) do nxor := [op(nxor), op(i, n2dual) ] ; i := i+1 ; od ; add( op(i, nxor)*2^(i-1), i=1..nops(nxor)) ; end: for n from 1 to 80 do printf("%d, ", A112591(n)) ; od ; # R. J. Mathar, Mar 07 2007
with(Bits):seq(Xor(ithprime(n), ithprime(n+1)), n=1..50) # Gary Detlefs, Aug 03 2013
MATHEMATICA
BitXor@@#&/@Partition[Prime[Range[80]], 2, 1] (* Harvey P. Dale, May 04 2018 *)
PROG
(PARI) a(n) = bitxor(prime(n), prime(n+1)); \\ Joerg Arndt, Aug 04 2013
(Scala) val prime: LazyList[Int] = 2 #:: LazyList.from(3).filter(i => prime.takeWhile { j => j * j <= i }.forall { k => i % k != 0 })
(0 to 127).map(n => prime(n) ^ prime(n + 1)) // Alonso del Arte, Apr 18 2020
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Sandeep Chellappen (sandeep.chellappen(AT)gmail.com), Dec 18 2005
EXTENSIONS
More terms and better name from Christopher M. Herron (cmh285(AT)psu.edu), Apr 25 2006
STATUS
approved