login
A373289
Triangle read by rows: for 1 <= k <= n, T(n,k) is a number with n binary digits and binary weight k whose sum of decimal digits is least; in case of a tie, choose the least such number.
2
1, 2, 3, 4, 5, 7, 8, 10, 11, 15, 16, 20, 21, 30, 31, 32, 40, 41, 51, 61, 63, 64, 80, 100, 101, 110, 111, 127, 128, 130, 200, 201, 211, 221, 223, 255, 256, 320, 400, 300, 301, 311, 501, 510, 511, 512, 520, 521, 600, 601, 1000, 1001, 1011, 1021, 1023, 1024, 1040, 1030, 1100, 1101, 2000, 2001, 2010
OFFSET
1,2
LINKS
Robert Israel, Table of n, a(n) for n = 1..325 (rows 1 to 25, flattened)
FORMULA
T(A123384(i),A118738(i)) = 10^i.
T(m,1) = 2^(m-1).
T(m,m) = 2^m - 1.
EXAMPLE
T(5,3) = 21 because 21 = 10101_2 has 5 binary digits of which 3 are 1, and it has a lower sum of decimal digits, 3, than the other numbers (19, 22, 25, 26 and 28) with 5 binary digits of which 3 are 1.
Triangle starts
1;
2, 3;
4, 5, 7;
8, 10, 11, 15;
16, 20, 21, 30, 31;
32, 40, 41, 51, 61, 63;
MAPLE
M:= proc(n, k) local i, R, m, b, r, v;
R:= ListTools:-Reverse(map(t -> 2^(n-1)+add(2^(n-1-t[i]), i=1..k-1), combinat:-choose(n-1, k-1 )));
m:= infinity;
for r in R do
v:= convert(convert(r, base, 10), `+`);
if v < m then b:= r; m:= v fi;
od;
b
end proc:
for n from 1 to 12 do
seq(M(n, k), k=1..n)
od;
CROSSREFS
KEYWORD
nonn,base,tabl
AUTHOR
Robert Israel, May 30 2024
STATUS
approved