%I #21 Mar 21 2024 16:29:11
%S 21,63,66,75,189,198,201,225,228,237,567,594,603,606,675,684,687,711,
%T 714,723,1701,1782,1809,1818,1821,2025,2052,2061,2064,2133,2142,2145,
%U 2169,2172,2181,5103,5346,5427,5454,5463,5466
%N Numbers whose ternary representation consists of a run of 2's, then a run of 1's, then a run of 0's.
%C All the numbers are multiples of 3.
%H Robert Israel, <a href="/A371052/b371052.txt">Table of n, a(n) for n = 1..10000</a>
%e The ternary representations of 21, 63, 66 are 210, 2100, 2110.
%p seq(seq(seq((2*(3^d-3^(d-a))+3^(d-a)-3^(d-a-b))/2,b=1..d-1-a),a=1..d-2),d=3..10); # _Robert Israel_, Mar 21 2024
%t Map[#[[1]] &, Select[Map[{#, Map[#[[1]] &, Split[IntegerDigits[#, 3]]] == {2, 1, 0}} &,
%t Range[0, 6000, 3]], #[[2]] &]] (* this sequence *)
%t ToExpression[Map[IntegerString[#, 3] &, %]] (* A371053 *)
%t (* _Peter J. C. Moses_, Mar 06 2024 *)
%o (Python)
%o from itertools import count, islice
%o def A371052_gen(): # generator of terms
%o return ((3**b*(3**a-1)+(3**b-1>>1))*3**(l-a-b) for l in count(3) for a in range(1,l-1) for b in range(1,l-a))
%o A371052_list = list(islice(A371052_gen(),20)) # _Chai Wah Wu_, Mar 21 2024
%Y Cf. A007089, A008585, A371053.
%K nonn,base,look
%O 1,1
%A _Clark Kimberling_, Mar 17 2024
|