OFFSET
1,3
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..10000
MAPLE
q:= n-> (f-> is(f(n, 10)<=f(n, 2)))((x, b)
-> add(i, i=convert(x, base, b))):
select(q, [$0..1500])[]; # Alois P. Heinz, Sep 06 2019
MATHEMATICA
Select[Range[0, 1007], Total[IntegerDigits[#]]<=Total[IntegerDigits[#, 2]]&] (* Metin Sariyar, Sep 14 2019 *)
PROG
(Python)
x=0
#Adjust the inequality below to generate more numbers of the sequence
while(x<100):
x = x+1
Number = int(bin(x)[2:])
Bin_Sum = 0
while(Number > 0):
Reminder = Number % 10
Bin_Sum = Bin_Sum + Reminder
Number = Number //10
Number = x
Sum = 0
while(Number > 0):
Reminder = Number % 10
Sum = Sum + Reminder
Number = Number //10
if (Sum <= Bin_Sum):
print(x)
(Python)
def ok(n): return sum(map(int, str(n))) <= bin(n).count('1')
print(list(filter(ok, range(1008)))) # Michael S. Branicky, Oct 11 2021
(PARI) isok(n) = sumdigits(n, 10) <= sumdigits(n, 2); \\ Michel Marcus, Sep 07 2019
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Frederick John Bernet III, Sep 06 2019
STATUS
approved