login
Numbers whose ternary representation consists of a run of 1's, then a run of 0's, then a run of 2's.
1

%I #16 Mar 20 2024 11:49:11

%S 11,29,35,38,83,89,107,110,116,119,245,251,269,323,326,332,350,353,

%T 359,362,731,737,755,809,971,974,980,998,1052,1055,1061,1079,1082,

%U 1088,1091,2189,2195,2213,2267,2429,2915,2918,2924,2942,2996,3158,3161,3167,3185

%N Numbers whose ternary representation consists of a run of 1's, then a run of 0's, then a run of 2's.

%C a(n) == 2 (mod 3) for all n.

%t Map[#[[1]] &, Select[Map[{#, Map[#[[1]] &, Split[IntegerDigits[#, 3]]] == {1, 0, 2}} &,

%t Range[2, 4000, 3]], #[[2]] &]] (* this sequence *)

%t ToExpression[Map[IntegerString[#, 3] &, %]] (* A371055 *)

%t (* _Peter J. C. Moses_, Mar 06 2024 *)

%o (Python)

%o from itertools import count, islice

%o def A371054_gen(): # generator of terms

%o return (3**(l-a)*(3**a-1>>1)+3**b-1 for l in count(3) for a in range(1,l-1) for b in range(1,l-a))

%o A371054_list = list(islice(A371054_gen(),20)) # _Chai Wah Wu_, Mar 20 2024

%Y Cf. A007089, A371055.

%K nonn,base

%O 1,1

%A _Clark Kimberling_, Mar 19 2024