login
A370856
Numbers m such that c(0) <= c(1) <= c(2), where c(k) = number of k's in the ternary representation of m.
7
2, 5, 7, 8, 11, 15, 17, 19, 21, 23, 25, 26, 35, 44, 47, 50, 51, 52, 53, 59, 61, 65, 68, 69, 70, 71, 73, 75, 76, 77, 79, 80, 98, 104, 106, 107, 116, 128, 132, 134, 140, 142, 143, 146, 150, 152, 154, 155, 156, 158, 159, 160, 161, 176, 178, 179, 184, 185, 187
OFFSET
1,1
LINKS
EXAMPLE
The ternary representation of 15 is 120, for which c(0)=1 <= c(1)=1 <= c(2)=1. So 15 is in the sequence.
MAPLE
c:= (p, i)-> coeff(p, x, i):
q:= n-> (p-> c(p, 0)<=c(p, 1) and c(p, 1)<=c(p, 2))(add(x^i, i=convert(n, base, 3))):
select(q, [$0..187])[]; # Alois P. Heinz, Mar 31 2026
MATHEMATICA
Select[Range[1000], DigitCount[#, 3, 0] <= DigitCount[#, 3, 1] <= DigitCount[#, 3, 2] &]
PROG
(MATLAB) nmax = 1000; n = 1:nmax; for k = 1:nmax, c = arrayfun(@(m) sum(dec2base(k, 3)-'0'==m), 0:2); tf(k) = c(1)<=c(2) && c(2)<=c(3); end, a = n(tf); % Chris R. Rehmann, Oct 12 2025
(PARI) select( {is(n, b=3, r=0, c=Vec(0, b))=while(n, c[1+n%b]++; n\=b); c==vecsort(c, , r)}, [1..99]) \\ Optional args allow to chose a different base b, r=4 yields the "reverse" (cf. A370873), c=[2, 1, 0] gives the "strict order" analog A370853. - M. F. Hasler, Mar 31 2026
CROSSREFS
Cf. A370873: analog with reversed inequality; A072601 and A072602: base-2 analogs.
Sequence in context: A286693 A032724 A153308 * A216565 A383030 A285938
KEYWORD
nonn,base
AUTHOR
Clark Kimberling, Mar 03 2024
STATUS
approved