A161155 Positive integers n such that {the number of (non-leading) 0's in the binary representation of n} is coprime to n, {the number of 1's in the binary representation of n} is coprime to n and {the number of digits in the binary representation of n} is coprime to n.
1, 5, 9, 11, 13, 17, 19, 23, 27, 29, 35, 37, 41, 43, 47, 49, 53, 59, 61, 67, 71, 73, 79, 83, 85, 87, 89, 93, 95, 97, 101, 103, 107, 109, 113, 117, 121, 125, 131, 133, 135, 137, 139, 141, 143, 147, 149, 151, 153, 157, 161, 163, 165, 167, 169, 173, 175, 177, 179, 181
Offset: 1
Links
- Indranil Ghosh, Table of n, a(n) for n = 1..1000
Programs
-
Mathematica
Select[Range[181], GCD[DigitCount[#,2,0] , #]==1 && GCD[DigitCount[#,2,1],#]==1 && GCD[Length[IntegerDigits[#,2]],#]==1 &] (* Indranil Ghosh, Mar 08 2017 *)
-
PARI
b0(n) = if(n<1, 0, b0(n\2) + 1 - n%2); b1(n) = if(n<1, 0, b1(n\2) + n%2); for (n=1, 181, if(gcd(b0(n), n) == 1 && gcd(b1(n), n) == 1 && gcd(#digits(n, 2), n) == 1, print1(n", "))) \\ Indranil Ghosh, Mar 08 2017
-
Python
from math import gcd i=j=1 while j<=100: 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: print(j, i) j+=1 i+=1 # Indranil Ghosh, Mar 08 2017
Extensions
Extended by Ray Chandler, Jun 11 2009
Comments