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.

A161156 Positive integers n such that {the number of (non-leading) 0's in the binary representation of n} is coprime to n, and {the number of 1's in the binary representation of n} is coprime to n, but {the number of digits in the binary representation of n} is not coprime to n.

This page as a plain text file.
%I A161156 #19 Jun 28 2025 11:00:44
%S A161156 2,8,14,25,32,33,38,39,44,45,50,51,52,56,57,62,77,91,119,128,134,146,
%T A161156 148,152,158,164,176,182,188,194,196,206,208,214,218,224,236,242,244,
%U A161156 248,254,267,279,291,297,309,327,333,339,351,357,369,375,381,387,393
%N A161156 Positive integers n such that {the number of (non-leading) 0's in the binary representation of n} is coprime to n, and {the number of 1's in the binary representation of n} is coprime to n, but {the number of digits in the binary representation of n} is not coprime to n.
%C A161156 1 is the only integer of the form 2^k - 1 (k>=0) which is coprime to the number of 0's in its binary representation, because such integers contain no binary 0's, and 0 is considered here to be coprime only to 1.
%H A161156 Indranil Ghosh, <a href="/A161156/b161156.txt">Table of n, a(n) for n = 1..1000</a>
%t A161156 Select[Range[393], GCD[DigitCount[#, 2, 0] , #]==1 && GCD[DigitCount[#, 2, 1], #] == 1 && GCD[Length[IntegerDigits[#, 2]], #] != 1 &] (* _Indranil Ghosh_, Mar 08 2017 *)
%o A161156 (PARI) b0(n) = if(n<1, 0, b0(n\2) + 1 - n%2);
%o A161156 b1(n) = if(n<1, 0, b1(n\2) + n%2);
%o A161156 for (n=1, 393, if(gcd(b0(n), n) == 1 && gcd(b1(n), n) == 1 && gcd(#digits(n, 2), n) != 1, print1(n", "))); \\ _Indranil Ghosh_, Mar 08 2017
%o A161156 (Python)
%o A161156 from math import gcd
%o A161156 i=j=1
%o A161156 while j<=1000:
%o A161156     if gcd(bin(i)[2:].count("0"),i)==1 and gcd(bin(i)[2:].count("1"),i)==1 and gcd(len(bin(i)[2:]),i)!=1:
%o A161156         print(i, end=", ")
%o A161156         j+=1
%o A161156     i+=1 # _Indranil Ghosh_, Mar 08 2017
%Y A161156 Cf. A094387, A161152, A161153, A161154, A161155.
%K A161156 base,nonn
%O A161156 1,1
%A A161156 _Leroy Quet_, Jun 03 2009
%E A161156 Extended by _Ray Chandler_, Jun 11 2009