login
A393803
Numbers whose number of nonzero digits is identical in base 2 and 3.
2
0, 1, 2, 5, 10, 12, 13, 14, 20, 22, 24, 25, 26, 33, 35, 36, 37, 38, 42, 43, 53, 69, 71, 72, 73, 74, 77, 88, 100, 106, 113, 116, 120, 121, 122, 124, 137, 138, 139, 142, 147, 150, 151, 154, 156, 157, 158, 178, 184, 197, 201, 203, 204, 205, 206, 209, 210, 211, 214, 226, 228, 229
OFFSET
1,3
LINKS
MAPLE
q:= n-> (f-> f(n, 2)=f(n, 3))((k, b)-> nops(subs(0=[][], convert(k, base, b)))):
select(q, [$0..230])[]; # Alois P. Heinz, Apr 01 2026
MATHEMATICA
q[k_] := DigitCount[k, 2, 1] == Total[DigitCount[k, 3, {1, 2}]]; Select[Range[0, 230], q] (* Amiram Eldar, Mar 29 2026 *)
PROG
(Python)
def nonzero_digits(n, b):
count = 0
while n > 0:
if n % b: count += 1
n //= b
return count
def ok(n):
return nonzero_digits(n, 2) == nonzero_digits(n, 3)
print([k for k in range(230) if ok(k)]) # Vincenzo Manto, Apr 08 2026
CROSSREFS
Sequence in context: A018514 A018288 A245480 * A080792 A351062 A182656
KEYWORD
nonn,base
AUTHOR
Vincenzo Manto, Mar 29 2026
STATUS
approved