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.
%I A334172 #32 Sep 29 2022 15:06:00 %S A334172 2,1,5,3,9,3,29,27,21,29,5,51,61,59,37,49,57,1,123,113,121,99,117,71, %T A334172 123,125,115,121,99,113,3,245,253,225,253,245,193,251,245,225,249,245, %U A334172 129,251,253,235,243,195,249,243,249,225,245,5,505,501,509,485 %N A334172 Bitwise XNOR of prime(n) and prime(n + 1). %C A334172 XOR is exclusive OR, meaning that one bit is on and the other bit is off. XNOR is the negation of XOR, meaning that either both bits are on or both bits are off. For example, 4 in binary is 100 and 6 is 110. Then 100 XOR 110 is 010 but 100 XNOR 110 is 101. %C A334172 From Bertrand's postulate it follows that prime(n + 1) requires only one bit more than prime(n) if they're not the same bit width. In most computer implementations, however, the numbers are placed zero-padded into fixed bit widths using two's complement, making it necessary to make adjustments to avoid unintentionally negative numbers. - _Alonso del Arte_, Apr 18 2020 %H A334172 Rémy Sigrist, <a href="/A334172/b334172.txt">Table of n, a(n) for n = 1..10000</a> %H A334172 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/XNOR.html">XNOR</a> %H A334172 Wikipedia, <a href="https://en.wikipedia.org/wiki/Bitwise operation">Bitwise operation</a> %F A334172 a(n) = A035327(A112591(n)). %e A334172 The second prime is 3 (11 in binary) and the third prime is 5 (101 in binary). We see that 011 XNOR 101 = 001. Hence a(2) = 1. %e A334172 The fourth prime is 7 (111 in binary). We see that 101 XNOR 111 = 101. Hence a(3) = 5. %p A334172 a:= n-> (p-> Bits[Not](Bits[Xor](p, ithprime(n+1)), %p A334172 bits=1+ilog2(p)))(ithprime(n)): %p A334172 seq(a(n), n=1..70); # _Alois P. Heinz_, Apr 17 2020 %t A334172 Table[BitNot[BitXor[Prime[n], Prime[n + 1]]] + 2^Ceiling[Log[2, Prime[n + 1]]], {n, 50}] (* _Alonso del Arte_, Apr 17 2020 *) %o A334172 (Python) %o A334172 def XNORprime(n): %o A334172 return ~(primes[n] ^ primes[n+1]) + (1 << primes[n+1].bit_length()) %o A334172 (PARI) neg(p) = bitneg(p, #binary(p)); %o A334172 a(n) = my(p=prime(n), q=nextprime(p+1)); bitor(bitand(p, q), bitand(neg(p), neg(q))); \\ _Michel Marcus_, Apr 17 2020 %o A334172 (Scala) val prime: LazyList[Int] = 2 #:: LazyList.from(3).filter(i => prime.takeWhile { %o A334172 j => j * j <= i %o A334172 }.forall { %o A334172 k => i % k != 0 %o A334172 }) %o A334172 (0 to 63).map(n => ~(prime(n) ^ prime(n + 1)) + 2 * Integer.highestOneBit(prime(n + 1))) // _Alonso del Arte_, Apr 18 2020 %Y A334172 Cf. A000040, A112591, A175329, A175330, A334143. %K A334172 base,nonn %O A334172 1,1 %A A334172 _Christoph Schreier_, Apr 17 2020