login
Positive integers that are coprime to their number of digits in binary representation.
5

%I #21 May 01 2021 02:09:17

%S 1,3,4,5,7,9,11,13,15,16,17,18,19,21,22,23,24,26,27,28,29,31,35,37,41,

%T 43,47,49,53,55,59,61,64,65,66,67,68,69,71,72,73,74,75,76,78,79,80,81,

%U 82,83,85,86,87,88,89,90,92,93,94,95,96,97,99,100,101,102,103,104,106

%N Positive integers that are coprime to their number of digits in binary representation.

%H Indranil Ghosh, <a href="/A161153/b161153.txt">Table of n, a(n) for n = 1..1000</a>

%t Select[Range[106], GCD[Length[IntegerDigits[#, 2]], #]==1 &] (* _Indranil Ghosh_, Mar 08 2017 *)

%o (PARI) for(n=1, 106, if(gcd(#digits(n, 2), n)==1, print1(n,", "))) \\ _Indranil Ghosh_, Mar 08 2017

%o (Python)

%o from fractions import gcd

%o i=1

%o j=1

%o while j<=100:

%o if gcd(len(bin(i)[2:]),i)==1:

%o print(str(j)+" "+str(i))

%o j+=1

%o i+=1 # _Indranil Ghosh_, Mar 08 2017

%Y Cf. A094387, A161152, A161154, A161155, A161156.

%K base,nonn

%O 1,2

%A _Leroy Quet_, Jun 03 2009

%E Extended by _Ray Chandler_, Jun 11 2009

%E Name edited by _Michel Marcus_, Apr 30 2021