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.

A161152 Positive integers n such that {the number of (non-leading) 0's in the binary representation of n} is coprime to n.

This page as a plain text file.
%I A161152 #23 Jun 28 2025 10:56:01
%S A161152 1,2,5,6,8,9,11,13,14,17,19,20,21,23,25,27,29,30,32,33,35,37,38,39,41,
%T A161152 43,44,45,47,49,50,51,52,53,55,56,57,59,61,62,66,67,68,69,71,72,73,77,
%U A161152 79,81,83,85,86,87,89,91,92,93,95,96,97,101,103,106,107,109,111,113,115
%N A161152 Positive integers n such that {the number of (non-leading) 0's in the binary representation of n} is coprime to n.
%C A161152 1 is the only integer of the form 2^k - 1 (k>=0) included in this sequence, because such integers contain no binary 0's, and 0 is considered here to be coprime only to 1.
%H A161152 Indranil Ghosh, <a href="/A161152/b161152.txt">Table of n, a(n) for n = 1..1000</a>
%e A161152 13 is in the sequence because the number of non-leading 0 s in the binary representation of 13 is 1 (13_10 = 1101_2) and gcd(1, 13) = 1. - _Indranil Ghosh_, Mar 08 2017
%t A161152 Select[Range[115], GCD[DigitCount[#, 2, 0], #] == 1 &] (* _Indranil Ghosh_, Mar 08 2017 *)
%o A161152 (PARI) b(n) = if(n<1, 0, b(n\2) + 1 - n%2);
%o A161152 for (n=1, 115, if(gcd(b(n),n)==1, print1(n", "))); \\ _Indranil Ghosh_, Mar 08 2017
%o A161152 (Python)
%o A161152 from math import gcd
%o A161152 i=j=1
%o A161152 while j<=100:
%o A161152     if gcd(bin(i)[2:].count("0"),i)==1:
%o A161152         print(j, i)
%o A161152         j+=1
%o A161152     i+=1 # _Indranil Ghosh_, Mar 08 2017
%Y A161152 Cf. A023416, A094387, A161153, A161154, A161155, A161156.
%K A161152 base,nonn
%O A161152 1,2
%A A161152 _Leroy Quet_, Jun 03 2009
%E A161152 Extended by _Ray Chandler_, Jun 11 2009