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-8 of 8 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

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

A169811 a(n) = n XOR n*(n+1)/2.

Original entry on oeis.org

0, 0, 1, 5, 14, 10, 19, 27, 44, 36, 61, 73, 66, 86, 103, 119, 152, 136, 185, 173, 198, 242, 235, 259, 308, 348, 325, 353, 394, 430, 463, 495, 560, 528, 625, 597, 702, 666, 707, 811, 796, 884, 941, 921, 1010, 1062, 1047, 1095, 1192, 1272, 1225, 1309, 1366, 1442, 1531
Offset: 0

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

A265885 a(n) = n IMPL prime(n), where IMPL is the bitwise logical implication.

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 25, 23, 23, 29, 31, 55, 59, 59, 63, 63, 63, 61, 111, 111, 107, 111, 123, 127, 103, 101, 103, 107, 111, 113, 127, 223, 223, 223, 221, 223, 223, 251, 255, 255, 247, 245, 255, 211, 215, 215, 211, 223, 239, 237, 237, 239, 251, 251, 457, 455
Offset: 1

Views

Author

Reinhard Zumkeller, Dec 17 2015

Keywords

Examples

			.   prime(25)=97 | 1100001
.             25 |   11001
.   -------------+--------
.     25 IMPL 97 | 1100111 -> a(25) = 103 .
		

Crossrefs

Programs

  • Haskell
    a265885 n = n `bimpl` a000040 n where
       bimpl 0 0 = 0
       bimpl p q = 2 * bimpl p' q' + if u <= v then 1 else 0
                   where (p', u) = divMod p 2; (q', v) = divMod q 2
    
  • Julia
    using IntegerSequences
    [Bits("IMP", n, p) for (n, p) in enumerate(Primes(1, 263))] |> println  # Peter Luschny, Sep 25 2021
    
  • Maple
    a:= n-> Bits[Implies](n, ithprime(n)):
    seq(a(n), n=1..56);  # Alois P. Heinz, Sep 24 2021
  • Mathematica
    IMPL[n_, k_] := If[n == 0, 0, BitOr[2^Length[IntegerDigits[k, 2]]-1-n, k]];
    a[n_] := n ~IMPL~ Prime[n];
    Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Sep 25 2021, after David A. Corneth's code in A265705 *)
  • PARI
    a(n) = bitor((2<Michel Marcus, Jan 22 2022

Formula

a(n) = A265705(A000040(n),n).

A194187 Difference of n-th prime and (bitwise XOR of n and n-th prime).

Original entry on oeis.org

-1, 2, -1, 4, -3, 2, -5, -8, -7, 6, 11, -4, 5, 6, 15, 16, 17, 14, -13, -12, -19, -10, 15, 24, -23, -26, -21, -12, -3, 2, 31, -32, -31, -30, -33, -28, -27, 30, 39, 40, 25, 22, 43, -44, -35, -34, -41, -16, 17, 14, 15, 20, 45, 46, -53, -56, -39, -38, -25, -12
Offset: 1

Views

Author

Reinhard Zumkeller, Oct 12 2011

Keywords

Comments

a(n) = A000040(n) - A070883(n).

Crossrefs

Programs

  • Haskell
    a194187_list = zipWith (-) a000040_list a070883_list
  • Mathematica
    #[[2]]-BitXor[#[[1]],#[[2]]]&/@Table[{n,Prime[n]},{n,60}] (* Harvey P. Dale, Oct 05 2023 *)

A344856 Bitwise XOR of prime(n) and n^2.

Original entry on oeis.org

3, 7, 12, 23, 18, 41, 32, 83, 70, 121, 102, 181, 128, 239, 206, 309, 282, 377, 298, 471, 496, 427, 578, 537, 528, 705, 702, 891, 804, 1013, 958, 1155, 1224, 1039, 1116, 1415, 1476, 1287, 1366, 1773, 1570, 1617, 1926, 1873, 1836, 2179, 2162, 2527, 2434, 2337
Offset: 1

Views

Author

Chris von Csefalvay, May 30 2021

Keywords

Comments

This is effectively the bitwise XOR of A000040 and A000290.

Examples

			For n=3, a(3) is prime(3) XOR 3^2 = 5 XOR 9 or b(0101) XOR b(1001) = (b)1100, which in base 10 is 12.
		

Crossrefs

Programs

  • Maple
    a:= n-> Bits[Xor](n^2, ithprime(n)):
    seq(a(n), n=1..50);  # Alois P. Heinz, May 30 2021
  • Mathematica
    a[n_] := BitXor[n^2, Prime[n]]; Array[a, 50] (* Amiram Eldar, Jun 05 2021 *)
  • PARI
    A344856(n) = bitxor(prime(n),n*n); \\ Antti Karttunen, Jun 05 2021
    
  • Python
    from sympy import primerange, prime
    import numpy
    def a_vector(n):
        primes = list(primerange(0, prime(n)))
        squares = [x ** 2 for x in range(1, n)]
        return numpy.bitwise_xor(primes, squares)
    
  • Python
    from sympy import prime
    def A344856(n): return prime(n) ^ n**2 # Chai Wah Wu, Jun 12 2021

Formula

a(n) = prime(n) XOR n^2.
a(n) = A003987(A000040(n), A000290(n)).
Showing 1-8 of 8 results.