Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #19 Mar 20 2024 14:41:37
%S 15,42,45,51,123,126,132,135,153,159,366,369,375,378,396,402,405,459,
%T 477,483,1095,1098,1104,1107,1125,1131,1134,1188,1206,1212,1215,1377,
%U 1431,1449,1455,3282,3285,3291,3294,3312,3318,3321,3375,3393,3399,3402,3564
%N Numbers whose ternary representation consists of a run of 1's, then a run of 2's, then a run of 0's.
%C All the numbers are multiples of 3.
%e The ternary representations of 15, 42, 45 are 120, 1120, 1200.
%t Map[#[[1]] &, Select[Map[{#, Map[#[[1]] &, Split[IntegerDigits[#, 3]]] == {1, 2, 0}} &,
%t Range[0, 4000, 3]], #[[2]] &]] (* this sequence *)
%t Map[IntegerString[#, 3] &, %] (* A371051 *)
%t (* _Peter J. C. Moses_, Mar 06 2024 *)
%o (Python)
%o from itertools import count, islice
%o def A371050_gen(): # generator of terms
%o return ((3**b*(3**(l-a)-1>>1)+3**b-1)*3**(a-b) for l in count(3) for a in range(2,l) for b in range(1,a))
%o A371050_list = list(islice(A371050_gen(),20)) # _Chai Wah Wu_, Mar 20 2024
%Y Cf. A007089, A008585, A371051.
%K nonn,base
%O 1,1
%A _Clark Kimberling_, Mar 17 2024