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.

A268835 Main diagonal of arrays A268833 & A268834: a(n) = A101080(n, A268820(n, 2*n)).

This page as a plain text file.
%I A268835 #17 May 09 2021 07:54:52
%S A268835 0,1,2,1,2,3,2,3,2,3,4,5,2,1,4,3,2,3,4,5,4,3,6,5,2,3,2,1,4,5,4,3,2,3,
%T A268835 4,5,4,3,6,5,4,5,4,3,6,7,6,5,2,3,4,3,2,3,2,3,4,5,6,5,4,3,4,3,2,3,4,5,
%U A268835 4,3,6,5,4,5,4,3,6,7,6,5,4,5,6,5,4,5,4,5,6,7,8,7,6,5,6,5,2,3,4,3,4,5,4,5,2,3,4,5,2,1,4,3,4,5,6,5,6,5,6,5,4
%N A268835 Main diagonal of arrays A268833 & A268834: a(n) = A101080(n, A268820(n, 2*n)).
%H A268835 Antti Karttunen, <a href="/A268835/b268835.txt">Table of n, a(n) for n = 0..1024</a>
%H A268835 Indranil Ghosh, <a href="/A268835/a268835.txt">C program to generate the sequence</a>
%F A268835 a(n) = A101080(n, A268820(n, 2*n)).
%t A268835 A101080[n_, k_]:= DigitCount[BitXor[n, k], 2, 1];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]]]; a[r_, 0]:= 0; a[0, c_]:=c; a[r_, c_]:= A003188[1 + A006068[a[r - 1, c - 1]]]; Flatten@ Table[A101080[n, a[n, 2n]], {n, 0, 300}] (* _Indranil Ghosh_, Apr 02 2017 *)
%o A268835 (Scheme)
%o A268835 (define (A268835 n) (A101080bi n (A268820bi n (* 2 n))))
%o A268835 (define (A268835 n) (A268833bi n n)) ;; Code for A268833bi given in A268833.
%o A268835 (PARI)
%o A268835 b(n) = if(n<1, 0, b(n\2) + n%2);
%o A268835 A101080(n, k) = b(bitxor(n, k));
%o A268835 A003188(n) = bitxor(n, n\2);
%o A268835 A006068(n) = if(n<2, n, {my(m = A006068(n\2)); 2*m + (n%2 + m%2)%2});
%o A268835 A268820(r, c) = if(r==0, c, if(c==0, 0, A003188(1 + A006068(A268820(r - 1, c - 1)))));
%o A268835 for(n=0, 300, print1(A101080(n, A268820(n, 2*n)),", ")) \\ _Indranil Ghosh_, Apr 02 2017
%o A268835 (Python)
%o A268835 def A101080(n, k): return bin(n^k)[2:].count("1")
%o A268835 def A003188(n): return n^(n//2)
%o A268835 def A006068(n):
%o A268835     if n<2: return n
%o A268835     else:
%o A268835         m=A006068(n//2)
%o A268835         return 2*m + (n%2 + m%2)%2
%o A268835 def A268717(n): return 0 if n<1 else A003188(1 + A006068(n - 1))
%o A268835 def A268820(r, c): return c if r<1 else 0 if c<1 else A003188(1 + A006068(A268820(r - 1, c - 1)))
%o A268835 print([A101080(n, A268820(n, 2*n)) for n in range(301)]) # _Indranil Ghosh_, Apr 02 2017
%Y A268835 Cf. A101080, A268820, A268833, A268834.
%K A268835 nonn
%O A268835 0,3
%A A268835 _Antti Karttunen_, Feb 15 2016