A371054 Numbers whose ternary representation consists of a run of 1's, then a run of 0's, then a run of 2's.
11, 29, 35, 38, 83, 89, 107, 110, 116, 119, 245, 251, 269, 323, 326, 332, 350, 353, 359, 362, 731, 737, 755, 809, 971, 974, 980, 998, 1052, 1055, 1061, 1079, 1082, 1088, 1091, 2189, 2195, 2213, 2267, 2429, 2915, 2918, 2924, 2942, 2996, 3158, 3161, 3167, 3185
Offset: 1
Programs
-
Mathematica
Map[#[[1]] &, Select[Map[{#, Map[#[[1]] &, Split[IntegerDigits[#, 3]]] == {1, 0, 2}} &, Range[2, 4000, 3]], #[[2]] &]] (* this sequence *) ToExpression[Map[IntegerString[#, 3] &, %]] (* A371055 *) (* Peter J. C. Moses, Mar 06 2024 *) Take[With[{nn=6},Flatten[Table[FromDigits[Join[PadRight[{},z,1],PadRight[{},o,0],PadRight[{},t,2]],3],{z,nn},{o,nn},{t,nn}]]]//Sort,50] (* Harvey P. Dale, Mar 29 2025 *)
-
Python
from itertools import count, islice def A371054_gen(): # generator of terms 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)) A371054_list = list(islice(A371054_gen(),20)) # Chai Wah Wu, Mar 20 2024
Comments