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.

A112591 a(n) = prime(n) XOR prime(n + 1).

This page as a plain text file.
%I A112591 #55 Sep 24 2024 09:46:38
%S A112591 1,6,2,12,6,28,2,4,10,2,58,12,2,4,26,14,6,126,4,14,6,28,10,56,4,2,12,
%T A112591 6,28,14,252,10,2,30,2,10,62,4,10,30,6,10,126,4,2,20,12,60,6,12,6,30,
%U A112591 10,506,6,10,2,26,12,2,62,22,4,14,4,118,26,10,6,60,6,8,26,14,4,250,8,28,8
%N A112591 a(n) = prime(n) XOR prime(n + 1).
%C A112591 When represented in binary, this sequence represents the uncommon bits in two consecutive prime numbers.
%C A112591 a(n) = 2 for indices of the lesser twin primes of the form 4k + 1, A071695. - _Michel Marcus_, Apr 17 2020
%H A112591 Harvey P. Dale, <a href="/A112591/b112591.txt">Table of n, a(n) for n = 1..1000</a>
%e A112591 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.
%p A112591 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
%p A112591 with(Bits):seq(Xor(ithprime(n),ithprime(n+1)),n=1..50) # _Gary Detlefs_, Aug 03 2013
%t A112591 BitXor@@#&/@Partition[Prime[Range[80]], 2, 1] (* _Harvey P. Dale_, May 04 2018 *)
%o A112591 (PARI) a(n) = bitxor(prime(n),prime(n+1)); \\ _Joerg Arndt_, Aug 04 2013
%o A112591 (Scala) val prime: LazyList[Int] = 2 #:: LazyList.from(3).filter(i => prime.takeWhile { j => j * j <= i }.forall { k => i % k != 0 })
%o A112591 (0 to 127).map(n => prime(n) ^ prime(n + 1)) // _Alonso del Arte_, Apr 18 2020
%Y A112591 Cf. A003987, A071695, A375235.
%K A112591 nonn,base
%O A112591 1,2
%A A112591 Sandeep Chellappen (sandeep.chellappen(AT)gmail.com), Dec 18 2005
%E A112591 More terms and better name from Christopher M. Herron (cmh285(AT)psu.edu), Apr 25 2006