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.

A268726 Index of the toggled bit between n and A268717(n+1): a(n) = A000523(A003987(n, A268717(1+n))).

This page as a plain text file.
%I A268726 #23 May 07 2021 08:44:25
%S A268726 0,1,2,0,3,0,0,1,4,0,0,1,0,1,2,0,5,0,0,1,0,1,2,0,0,1,2,0,3,0,0,1,6,0,
%T A268726 0,1,0,1,2,0,0,1,2,0,3,0,0,1,0,1,2,0,3,0,0,1,4,0,0,1,0,1,2,0,7,0,0,1,
%U A268726 0,1,2,0,0,1,2,0,3,0,0,1,0,1,2,0,3,0,0,1,4,0,0,1,0,1,2,0,0,1,2,0,3,0,0,1,4,0,0,1,0,1,2,0,5,0,0,1,0,1,2,0,0
%N A268726 Index of the toggled bit between n and A268717(n+1): a(n) = A000523(A003987(n, A268717(1+n))).
%C A268726 A fractal sequence, because a permutation of A007814. Removing zeros yields A268727(n) = a(n)+1.
%H A268726 Antti Karttunen, <a href="/A268726/b268726.txt">Table of n, a(n) for n = 0..16383</a>
%H A268726 Indranil Ghosh, <a href="/A268726/a268726.txt">C program to generate the sequence</a>
%F A268726 a(n) = A007814(1 + A006068(n)).
%F A268726 a(n) = A000523(A003987(n, A268717(1+n))).
%F A268726 a(n) = floor(log_2(n XOR A003188(1 + A006068(n)))).
%F A268726 Other identities:
%F A268726 For all n >= 1, a(A003188(n-1)) = A007814(n).
%t A268726 A003188[n_]:=BitXor[n, Floor[n/2]]; A006068[n_]:=If[n<2, n, Block[{m=A006068[Floor[n/2]]}, 2m + Mod[Mod[n,2] + Mod[m, 2], 2]]]; A268717[n_]:=If[n<1, 0, A003188[1 + A006068[n - 1]]]; a[n_]:= Floor[Log[2, BitXor[n, A268717[n + 1]]]]; Table[a[n], {n, 0, 200}] (* _Indranil Ghosh_, Apr 02 2017 *)
%o A268726 (Scheme) (define (A268726 n) (A000523 (A003987bi n (A268717 (+ 1 n))))) ;; A003987bi implements the bitwise-XOR, defined in A003987.
%o A268726 (PARI) A003188(n) = bitxor(n, n\2);
%o A268726 A006068(n) = if(n<2, n, {my(m = A006068(n\2)); 2*m + (n%2 + m%2)%2});
%o A268726 A268717(n) = if(n<1, 0, A003188(1 + A006068(n - 1)));
%o A268726 for(n=0, 200, print1(logint(bitxor(n, A268717(n + 1)), 2),", "))  \\ _Indranil Ghosh_, Apr 02 2017
%o A268726 (Python)
%o A268726 def A003188(n): return n^(n//2)
%o A268726 def A006068(n):
%o A268726     if n<2: return n
%o A268726     else:
%o A268726         m=A006068(n//2)
%o A268726         return 2*m + (n%2 + m%2)%2
%o A268726 def A268717(n): return 0 if n<1 else A003188(1 + A006068(n - 1))
%o A268726 print([int(math.floor(math.log(n^A268717(n + 1), 2))) for n in range(201)]) # _Indranil Ghosh_, Apr 02 2017
%Y A268726 One less than A268727.
%Y A268726 Cf. A003188, A006068.
%Y A268726 Cf. A000523, A003987, A007814, A101080, A268717.
%Y A268726 Cf. also array A268833.
%K A268726 nonn,base
%O A268726 0,3
%A A268726 _Antti Karttunen_, Feb 13 2016