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.

Showing 1-5 of 5 results.

A169810 a(n) = n XOR n^2.

Original entry on oeis.org

0, 0, 6, 10, 20, 28, 34, 54, 72, 88, 110, 114, 156, 164, 202, 238, 272, 304, 342, 378, 388, 428, 498, 518, 600, 616, 702, 706, 780, 852, 922, 990, 1056, 1120, 1190, 1258, 1332, 1404, 1410, 1494, 1640, 1720, 1742, 1810, 1980, 1988, 2154, 2190, 2352, 2384, 2550, 2586
Offset: 0

Views

Author

N. J. A. Sloane, May 28 2010

Keywords

Comments

XOR the binary representations of n and n^2.

Examples

			a(5) = 28:
..101 <- 5
11001 <- 25
----- <- XOR
11100 -> 28
		

Crossrefs

Suggested by A174375. Cf. A070883, A169811-A169814.
Cf. A007745 (OR), A213541 (AND), A002378.

Programs

  • Haskell
    import Data.Bits (xor)
    a169810 n = n ^ 2 `xor` n :: Integer
    -- Reinhard Zumkeller, Dec 27 2012
    
  • Maple
    f:=proc(n) local i,t0,t1,t2,ts,tl,n1,n2;
    t1:=convert(n,base,2); t2:=convert(n^2,base,2); n1:=nops(t1); n2:=nops(t2);
    if n1 < n2 then ts:= t1; tl:=t2; else ts:=t2; tl:=t1; fi;
    t0:=[]; for i from 1 to nops(ts) do t0:=[op(t0), (ts[i] + tl[i]) mod 2 ]; od:
    for i from nops(ts)+1 to nops(tl) do t0:=[op(t0), tl[i]]; od:
    add(2^(i-1)*t0[i], i=1..nops(t0)); end;
    # second Maple program:
    a:= n-> Bits[Xor](n, n^2):
    seq(a(n), n=0..100);  # Alois P. Heinz, Mar 29 2018
  • Mathematica
    a[n_]:=BitXor[n, n^2]; Array[a, 60, 0] (* Robert G. Wilson v, Jun 09 2010 *)
  • PARI
    A169810(n)=bitxor(n^2,n) \\ M. F. Hasler, May 07 2023
    
  • Python
    A169810=lambda n:n**2^n # M. F. Hasler, May 07 2023

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

A169813 a(n) = n XOR sigma(n), where sigma(n) is the number of divisors of n, A000203.

Original entry on oeis.org

0, 1, 7, 3, 3, 10, 15, 7, 4, 24, 7, 16, 3, 22, 23, 15, 3, 53, 7, 62, 53, 50, 15, 36, 6, 48, 51, 36, 3, 86, 63, 31, 17, 20, 19, 127, 3, 26, 31, 114, 3, 74, 7, 120, 99, 102, 31, 76, 8, 111, 123, 86, 3, 78, 127, 64, 105, 96, 7, 148, 3, 94, 87, 63, 21, 210, 7, 58, 37, 214, 15, 139, 3, 56
Offset: 1

Views

Author

N. J. A. Sloane, May 28 2010

Keywords

Crossrefs

Programs

A169814 a(n) = n XOR phi(n).

Original entry on oeis.org

0, 3, 1, 6, 1, 4, 1, 12, 15, 14, 1, 8, 1, 8, 7, 24, 1, 20, 1, 28, 25, 28, 1, 16, 13, 22, 9, 16, 1, 22, 1, 48, 53, 50, 59, 40, 1, 52, 63, 56, 1, 38, 1, 56, 53, 56, 1, 32, 27, 38, 19, 44, 1, 36, 31, 32, 29, 38, 1, 44, 1, 32, 27, 96, 113, 86, 1, 100, 105, 94, 1, 80, 1, 110, 99, 104, 113, 86
Offset: 1

Views

Author

N. J. A. Sloane, May 28 2010

Keywords

Crossrefs

Programs

Formula

a(n) = 1 <=> n in { A065091 }. - Alois P. Heinz, Jul 06 2023

A169812 a(n) = n XOR d(n) (cf. A000005).

Original entry on oeis.org

0, 0, 1, 7, 7, 2, 5, 12, 10, 14, 9, 10, 15, 10, 11, 21, 19, 20, 17, 18, 17, 18, 21, 16, 26, 30, 31, 26, 31, 22, 29, 38, 37, 38, 39, 45, 39, 34, 35, 32, 43, 34, 41, 42, 43, 42, 45, 58, 50, 52, 55, 50, 55, 62, 51, 48, 61, 62, 57, 48, 63, 58, 57, 71, 69, 74, 65, 66, 65, 78, 69, 68, 75, 78
Offset: 1

Views

Author

N. J. A. Sloane, May 28 2010

Keywords

Crossrefs

Programs

  • Mathematica
    a[n_] := BitXor[n, DivisorSigma[0, n]]; Array[a, 100] (* Amiram Eldar, Jul 08 2019 *)
  • PARI
    a(n)=bitxor(n, numdiv(n)); \\ Michel Marcus, Jul 08 2019
Showing 1-5 of 5 results.