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.

A231550 Permutation of nonnegative integers: for each bit[i] in the binary representation, except the most and the least significant bits, set bit[i] = bit[i] XOR bit[i-1], where bit[i-1] is the less significant bit, XOR is the binary logical exclusive or operator.

This page as a plain text file.
%I A231550 #47 Jul 18 2021 02:04:39
%S A231550 0,1,2,3,4,7,6,5,8,11,14,13,12,15,10,9,16,19,22,21,28,31,26,25,24,27,
%T A231550 30,29,20,23,18,17,32,35,38,37,44,47,42,41,56,59,62,61,52,55,50,49,48,
%U A231550 51,54,53,60,63,58,57,40,43,46,45,36,39,34,33,64,67,70,69,76
%N A231550 Permutation of nonnegative integers: for each bit[i] in the binary representation, except the most and the least significant bits, set bit[i] = bit[i] XOR bit[i-1], where bit[i-1] is the less significant bit, XOR is the binary logical exclusive or operator.
%C A231550 This permutation transforms the enumeration system of positive irreducible fractions A020651/A020650 into the enumeration system A002487/A002487' (Calkin-Wilf), and enumeration system A245327/A245326 into A162911/A162912 (Drib). - _Yosu Yurramendi_, Jun 16 2015
%H A231550 Ivan Neretin, <a href="/A231550/b231550.txt">Table of n, a(n) for n = 0..8192</a>
%H A231550 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the nonnegative integers</a>
%F A231550 a(A231551(n)) = A231551(a(n)) = n.
%F A231550 a(n) = A284460(A258996(n)) = A092569(A284460(n)), n > 0. - _Yosu Yurramendi_, Apr 10 2017
%t A231550 Join[{0, 1}, Table[d = IntegerDigits[n, 2]; FromDigits[Join[{d[[1]]}, BitXor[Most@Rest@d, Rest@Rest@d], {d[[-1]]}], 2], {n, 2, 68}]] (* _Ivan Neretin_, Dec 28 2016 *)
%o A231550 (Python)
%o A231550 for n in range(99):
%o A231550   bits = [0]*64
%o A231550   orig = [0]*64
%o A231550   l = int.bit_length(int(n))
%o A231550   t = n
%o A231550   for i in range(l):
%o A231550     bits[i] = orig[i] = t&1
%o A231550     t>>=1
%o A231550   for i in range(1, l-1):  bits[i] ^= orig[i-1]   # A231550
%o A231550   #for i in range(1, l-1):  bits[i] ^= bits[i-1]   # A231551
%o A231550   #for i in range(l-1):  bits[i] ^= orig[i+1]      # A003188
%o A231550   #for i in range(1,l):  bits[l-1-i] ^= bits[l-i]  # A006068
%o A231550   t = 0
%o A231550   for i in range(l):  t += bits[i]<<i
%o A231550   print(str(t), end=',')
%o A231550 (R)
%o A231550 a <- 1
%o A231550 maxlevel <- 8 # by choice
%o A231550 #
%o A231550 for(m in 0:maxlevel) for(k in 0:(2^m-1)){
%o A231550   a[2^(m+1)  +2*k] <- 2*a[2^m+k]
%o A231550   a[2^(m+2)-1-2*k] <- 2*a[2^m+k] + 1
%o A231550 }
%o A231550 (a <- c(0,a))
%o A231550 # _Yosu Yurramendi_, Apr 10 2017
%o A231550 (PARI) a(n) = bitxor(n, if(n>3, bitand(n<<1, bitneg(0,logint(n,2))))); \\ _Kevin Ryde_, Jul 17 2021
%Y A231550 Cf. A003188, A006068, A231551.
%K A231550 nonn,look,base,easy
%O A231550 0,3
%A A231550 _Alex Ratushnyak_, Nov 10 2013