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

%I #10 Mar 30 2024 17:22:15

%S 19,55,58,73,163,166,175,217,220,235,487,490,499,526,649,652,661,703,

%T 706,721,1459,1462,1471,1498,1579,1945,1948,1957,1984,2107,2110,2119,

%U 2161,2164,2179,4375,4378,4387,4414,4495,4738,5833,5836,5845,5872,5953,6319

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

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

%t Map[#[[1]] &, Select[Map[{#, Map[#[[1]] &, Split[IntegerDigits[#, 3]]] == {2, 0, 1}} &, Range[1, 36000, 3]], #[[2]] &]] (* this sequence *)

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

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

%o (Python)

%o from itertools import count, islice

%o def A371056_gen(): # generator of terms

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

%o A371056_list = list(islice(A371056_gen(),20)) # _Chai Wah Wu_, Mar 30 2024

%Y Cf. A007089, A371057.

%K nonn,base

%O 1,1

%A _Clark Kimberling_, Mar 22 2024