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.

Showing 1-4 of 4 results.

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

Original entry on oeis.org

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, 43, 44, 45, 47, 49, 50, 51, 52, 53, 55, 56, 57, 59, 61, 62, 66, 67, 68, 69, 71, 72, 73, 77, 79, 81, 83, 85, 86, 87, 89, 91, 92, 93, 95, 96, 97, 101, 103, 106, 107, 109, 111, 113, 115
Offset: 1

Views

Author

Leroy Quet, Jun 03 2009

Keywords

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.

Examples

			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
		

Crossrefs

Programs

  • Mathematica
    Select[Range[115], GCD[DigitCount[#, 2, 0], #] == 1 &] (* Indranil Ghosh, Mar 08 2017 *)
  • PARI
    b(n) = if(n<1, 0, b(n\2) + 1 - n%2);
    for (n=1, 115, if(gcd(b(n),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:
            print(j, i)
            j+=1
        i+=1 # Indranil Ghosh, Mar 08 2017

Extensions

Extended by Ray Chandler, Jun 11 2009

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.

Original entry on oeis.org

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
Offset: 1

Views

Author

Leroy Quet, Jun 03 2009

Keywords

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.

Crossrefs

Programs

  • 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 *)
  • 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 math 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(j, i)
            j+=1
        i+=1 # Indranil Ghosh, Mar 08 2017

Extensions

Extended by Ray Chandler, Jun 11 2009

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.

Original entry on oeis.org

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

Views

Author

Leroy Quet, Jun 03 2009

Keywords

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.

Crossrefs

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

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.

Original entry on oeis.org

2, 8, 14, 25, 32, 33, 38, 39, 44, 45, 50, 51, 52, 56, 57, 62, 77, 91, 119, 128, 134, 146, 148, 152, 158, 164, 176, 182, 188, 194, 196, 206, 208, 214, 218, 224, 236, 242, 244, 248, 254, 267, 279, 291, 297, 309, 327, 333, 339, 351, 357, 369, 375, 381, 387, 393
Offset: 1

Views

Author

Leroy Quet, Jun 03 2009

Keywords

Comments

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.

Crossrefs

Programs

  • Mathematica
    Select[Range[393], 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, 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
    
  • Python
    from math import gcd
    i=j=1
    while j<=1000:
        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(i, end=", ")
            j+=1
        i+=1 # Indranil Ghosh, Mar 08 2017

Extensions

Extended by Ray Chandler, Jun 11 2009
Showing 1-4 of 4 results.