A108580 Numbers whose sum of bits when written in binary > sum of decimal digits.
10, 11, 30, 31, 100, 101, 102, 103, 110, 111, 120, 121, 200, 201, 210, 211, 220, 221, 300, 301, 310, 311, 500, 501, 510, 511, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1010, 1011, 1012, 1013, 1014, 1015, 1020, 1021, 1022, 1023, 1100, 1101, 1102, 1103
Offset: 1
Examples
1103 is on the list since 1103 is 10001001111 (sum=6), 1+1+0+3=5.
Links
- Marius A. Burtea, Table of n, a(n) for n = 1..5000
Programs
-
Magma
[n:n in [1..1200]| &+Intseq(n,2) gt &+Intseq(n,10)]; // Marius A. Burtea, Sep 07 2019
-
Mathematica
Select[Range[1103], Total@IntegerDigits[#, 2] > Total@IntegerDigits[#, 10] &] (* Amiram Eldar, Sep 07 2019 *)
-
PARI
isok(n) = hammingweight(n) > sumdigits(n); \\ Michel Marcus, Sep 07 2019
-
Python
def ok(n): return sum(map(int, str(n))) < bin(n).count('1') print(list(filter(ok, range(1104)))) # Michael S. Branicky, Oct 11 2021
Extensions
a(36) added by Marius A. Burtea, Sep 07 2019
Comments