login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A161154 Positive integers n such that both {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. 5
1, 2, 5, 8, 9, 11, 13, 14, 17, 19, 23, 25, 27, 29, 32, 33, 35, 37, 38, 39, 41, 43, 44, 45, 47, 49, 50, 51, 52, 53, 56, 57, 59, 61, 62, 67, 71, 73, 77, 79, 83, 85, 87, 89, 91, 93, 95, 97, 101, 103, 107, 109, 113, 117, 119, 121, 125, 128, 131, 133, 134, 135, 137, 139, 141 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
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.
LINKS
MATHEMATICA
bcpQ[n_]:=Module[{ones=DigitCount[n, 2, 1], zeros=DigitCount[n, 2, 0]}, And@@ CoprimeQ[ {ones, zeros}, n]]; Select[Range[150], bcpQ] (* Harvey P. Dale, Feb 19 2012 *)
PROG
(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, 141, if(gcd(b0(n), n)==1 && gcd(b1(n), n)==1, print1(n", "))) \\ Indranil Ghosh, Mar 08 2017
(Python)
from fractions import gcd
i=j=1
while j<=100:
if gcd(bin(i)[2:].count("0"), i)==1==gcd(bin(i)[2:].count("1"), i):
print(str(j)+" "+str(i))
j+=1
i+=1 # Indranil Ghosh, Mar 08 2017
CROSSREFS
Sequence in context: A212591 A153275 A362310 * A174438 A176061 A183234
KEYWORD
base,nonn
AUTHOR
Leroy Quet, Jun 03 2009
EXTENSIONS
Extended by Ray Chandler, Jun 11 2009
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 28 08:02 EDT 2024. Contains 371236 sequences. (Running on oeis4.)