A178729 a(n) = n XOR 3n, where XOR is bitwise XOR.
0, 2, 4, 10, 8, 10, 20, 18, 16, 18, 20, 42, 40, 42, 36, 34, 32, 34, 36, 42, 40, 42, 84, 82, 80, 82, 84, 74, 72, 74, 68, 66, 64, 66, 68, 74, 72, 74, 84, 82, 80, 82, 84, 170, 168, 170, 164, 162, 160, 162, 164, 170, 168, 170, 148, 146, 144, 146, 148, 138, 136, 138, 132, 130
Offset: 0
Links
- Vincenzo Librandi, Table of n, a(n) for n = 0..5000
- Helena A. Verrill, Note on the negative base xor sequence n⊕-b(-n), arXiv:2506.09509 [math.NT], 2025.
Crossrefs
Programs
-
Magma
[BitwiseXor(n, 3*n): n in [0..80]]; // Vincenzo Librandi, Jul 11 2017
-
Mathematica
f[n_] := BitXor[n, 3 n]; Array[f, 70, 0] (* Robert G. Wilson v, Jun 09 2010 *)
-
PARI
a(n) = bitxor(n, 3*n); \\ Michel Marcus, Jul 11 2017
-
Python
def A178729(n): return n^ 3*n # Chai Wah Wu, Jun 29 2022
Formula
a(n) = 2 * A184617(n). - Alois P. Heinz, Jul 21 2017
Extensions
a(30) onwards from Robert G. Wilson v, Jun 09 2010