The OEIS is supported by the many generous donors to the OEIS Foundation.

a(0) = 0, and for any n > 0, a(n) is the least positive multiple of n whose balanced ternary expansion contains as many negative trits as positive trits.

1

`%I #6 Jul 13 2022 14:43:36
`

`%S 0,2,2,6,8,20,6,56,8,18,20,154,24,26,56,60,16,136,18,266,20,168,154,
`

`%T 46,24,400,26,54,56,232,60,62,32,462,136,70,72,74,266,78,80,164,168,
`

`%U 86,440,180,46,188,48,98,400,408,52,424,54,440,56,798,232,236,60
`

`%N a(0) = 0, and for any n > 0, a(n) is the least positive multiple of n whose balanced ternary expansion contains as many negative trits as positive trits.
`

`%C A174658 corresponds to fixed points.
`

`%F a(n) = n * A355639(n).
`

`%e For n = 5:
`

`%e - the first multiple of 5 (alongside their balanced ternary expansions) are:
`

`%e k k*5 bter(k*5) #1 #T
`

`%e - --- --------- -- --
`

`%e 1 5 1TT 1 2
`

`%e 2 10 101 2 0
`

`%e 3 15 1TT0 1 2
`

`%e 4 20 1T1T 2 2
`

`%e - negative and positive trits are first balanced for k = 4,
`

`%e - so a(5) = 4*5 = 20.
`

`%o (PARI) a(n) = { for (k=1, oo, my (m=k*n, s=0, d); while (m, m=(m-d=[0, 1, -1][1+m%3])/3; s+=d); if (s==0, return (k*n))) }
`

`%Y See A143146 for a similar sequence.
`

`%Y Cf. A065363, A174658 (fixed points), A355639.
`

`%K nonn,base
`

`%O 0,2
`

`%A _Rémy Sigrist_, Jul 11 2022
`