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.

A070883 Bitwise XOR of n and n-th prime.

Original entry on oeis.org

3, 1, 6, 3, 14, 11, 22, 27, 30, 23, 20, 41, 36, 37, 32, 37, 42, 47, 80, 83, 92, 89, 68, 65, 120, 127, 124, 119, 112, 111, 96, 163, 168, 169, 182, 179, 184, 133, 128, 133, 154, 159, 148, 237, 232, 233, 252, 239, 210, 215, 218, 219, 196, 205, 310, 319, 308, 309, 302
Offset: 1

Views

Author

Reinhard Zumkeller, May 22 2002

Keywords

Comments

For any integer k, XOR(n,k) = 2*OR(n,k) - (n+k). - Gary Detlefs, Oct 26 2013

Examples

			A000040(25)=97, [25]2 = '00011001', [97]2 = '01100001' '00011001' XOR '01100001' = '01111000', therefore a(25)=120.
		

Crossrefs

Cf. A265885 (IMPL).

Programs

  • Haskell
    import Data.Bits (xor)
    a070883 n = a070883_list !! (n-1)
    a070883_list = zipWith xor [1..] a000040_list
    -- Reinhard Zumkeller, Jun 23 2015
    
  • Mathematica
    Table[ BitXor[ n, Prime[n]], {n, 1, 55}]
  • PARI
    a(n) = bitxor(n, prime(n));
    
  • Python
    from sympy import prime
    def a(n): return n^prime(n)
    print([a(n) for n in range(1, 60)]) # Michael S. Branicky, Mar 05 2022

Formula

a(n) = 2*OR(p,n) - (p+n), for n-th prime p. - Gary Detlefs, Oct 26 2013