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.

A231551 Position of n in A231550.

This page as a plain text file.
%I A231551 #42 Sep 22 2024 17:47:35
%S A231551 0,1,2,3,4,7,6,5,8,15,14,9,12,11,10,13,16,31,30,17,28,19,18,29,24,23,
%T A231551 22,25,20,27,26,21,32,63,62,33,60,35,34,61,56,39,38,57,36,59,58,37,48,
%U A231551 47,46,49,44,51,50,45,40,55,54,41,52,43,42,53,64,127,126,65
%N A231551 Position of n in A231550.
%C A231551 This permutation transforms the enumeration system of positive irreducible fractions A002487/A002487' (Calkin-Wilf) into the enumeration system A020651/A020650, and A162911/A162912 (Drib) the enumeration system into A245327/A245326. - _Yosu Yurramendi_, Jun 16 2015
%H A231551 Ivan Neretin, <a href="/A231551/b231551.txt">Table of n, a(n) for n = 0..8192</a>
%H A231551 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the nonnegative integers</a>
%F A231551 A231550(a(n)) = a(A231550(n)) = n.
%F A231551 a(n) = A258996(A284460(n)) = A284459(A092569(n)), n > 0. - _Yosu Yurramendi_, Apr 10 2017
%F A231551 a(n) = A054429(A153154(n)), n > 0. - _Yosu Yurramendi_, Oct 04 2021
%t A231551 Join[{0, 1}, Table[d = Reverse@IntegerDigits[n, 2]; FromDigits[Reverse@Append[FoldList[BitXor, d[[1]], Most@Rest@d], d[[-1]]], 2], {n, 2, 67}]] (* _Ivan Neretin_, Dec 28 2016 *)
%o A231551 (Python)
%o A231551 for n in range(99):
%o A231551   bits = [0]*64
%o A231551   orig = [0]*64
%o A231551   l = int.bit_length(int(n))
%o A231551   t = n
%o A231551   for i in range(l):
%o A231551     bits[i] = orig[i] = t&1
%o A231551     t>>=1
%o A231551   #for i in range(1, l-1):  bits[i] ^= orig[i-1]   # A231550
%o A231551   for i in range(1, l-1):  bits[i] ^= bits[i-1]   # A231551
%o A231551   #for i in range(l-1):  bits[i] ^= orig[i+1]      # A003188
%o A231551   #for i in range(1, l):  bits[l-1-i] ^= bits[l-i]  # A006068
%o A231551   t = 0
%o A231551   for i in range(l):  t += bits[i]<<i
%o A231551   print(str(t), end=', ')
%o A231551 (R)
%o A231551 maxrow <- 8 # by choice
%o A231551 b01 <- 0 # b01 is going to be A010059
%o A231551 a <- 1
%o A231551 for(m in 0:maxrow) for(k in 0:(2^m-1)){
%o A231551    b01[2^(m+1)+    k] <-     b01[2^m+k]
%o A231551      a[2^(m+1)+    k] <-       a[2^m+k]  + 2^(m+b01[2^(m+1)+    k])
%o A231551    b01[2^(m+1)+2^m+k] <- 1 - b01[2^m+k]
%o A231551      a[2^(m+1)+2^m+k] <-       a[2^m+k]  + 2^(m+b01[2^(m+1)+2^m+k])
%o A231551 }
%o A231551 (a <- c(0,a))
%o A231551 # _Yosu Yurramendi_, Apr 10 2017
%o A231551 (R)
%o A231551 maxblock <- 8 # by choice
%o A231551 a <- 1:3
%o A231551 for(n in 4:2^maxblock){
%o A231551 ones <- which(as.integer(intToBits(n)) == 1)
%o A231551 nbit <- as.integer(intToBits(n))[1:tail(ones, n = 1)]
%o A231551 anbit <- nbit
%o A231551 for(i in 2:(length(anbit) - 1))
%o A231551    anbit[i] <- bitwXor(anbit[i], anbit[i-1])  # ?bitwXor
%o A231551 a <- c(a, sum(anbit*2^(0:(length(anbit) - 1))))
%o A231551 }
%o A231551 (a <- c(0,a))
%o A231551 # _Yosu Yurramendi_, Apr 25 2021
%Y A231551 Cf. A003188, A006068, A231550.
%K A231551 nonn,easy,look
%O A231551 0,3
%A A231551 _Alex Ratushnyak_, Nov 10 2013