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.

A352993 a(n) is the n-th positive integer that has no common 1-bit with n; a(0) = 0.

This page as a plain text file.
%I A352993 #14 Apr 21 2022 12:21:37
%S A352993 0,2,4,12,8,18,24,56,16,34,36,84,48,98,112,240,32,66,68,140,72,162,
%T A352993 168,360,96,194,196,420,224,450,480,992,64,130,132,268,136,274,280,
%U A352993 600,144,322,324,660,336,706,720,1488,192,386,388,780,392,834,840,1736
%N A352993 a(n) is the n-th positive integer that has no common 1-bit with n; a(0) = 0.
%C A352993 This sequence corresponds to the main diagonal of A295653.
%C A352993 To compute a(n):
%C A352993 - consider the binary expansion of n: Sum_{k >= 0} b_k * 2^k,
%C A352993 - and the positions of zeros in this binary expansion: {z_k, k >= 0},
%C A352993 - then a(n) = Sum_{k >= 0} b_k * 2^z(k).
%H A352993 Rémy Sigrist, <a href="/A352993/b352993.txt">Table of n, a(n) for n = 0..8192</a>
%H A352993 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%F A352993 a(n) = A295653(n, n).
%F A352993 a(2^k) = 2^(k+1) for any k >= 0.
%F A352993 a(2^k-1) = A020522(k) for any k >= 0.
%F A352993 A000120(a(n)) = A000120(n).
%F A352993 A070939(a(n)) = A070939(n) + A000120(n).
%e A352993 For n = 43:
%e A352993 - the binary expansion of 43 is       "... 0 0 0 0 1 0 1 0 1 1"
%e A352993 - so the binary expansion of a(43) is "... 1 0 1 0(0)1(0)1(0 0)",
%e A352993 - and a(43) = 660.
%o A352993 (PARI) a(n) = { my (m=n, v=0); for (e=0, oo, if (n==0, return (v), !bittest(m, e), if (n%2, v+=2^e;); n\=2)) }
%o A352993 (Python)
%o A352993 def a(n):
%o A352993     b = bin(n)[2:][::-1]
%o A352993     z = [k for k, bk in enumerate(b+'0'*(len(b)-b.count('0'))) if bk=='0']
%o A352993     return sum(int(bk)*2**zk for bk, zk in zip(b, z))
%o A352993 print([a(n) for n in range(56)]) # _Michael S. Branicky_, Apr 21 2022
%Y A352993 Cf. A000120, A020522, A070939, A295653.
%K A352993 nonn,base
%O A352993 0,2
%A A352993 _Rémy Sigrist_, Apr 14 2022