A371276 Nonnegative numbers whose balanced ternary expansions have no consecutive equal digits (with offset 0).
0, 1, 2, 3, 6, 7, 8, 10, 17, 19, 20, 21, 24, 25, 29, 30, 51, 52, 56, 57, 60, 61, 62, 64, 71, 73, 74, 75, 87, 88, 89, 91, 152, 154, 155, 156, 168, 169, 170, 172, 179, 181, 182, 183, 186, 187, 191, 192, 213, 214, 218, 219, 222, 223, 224, 226, 260, 262, 263, 264
Offset: 0
Examples
The first terms, alongside their balanced ternary expansions, are: n a(n) bter(a(n)) -- ---- ---------- 1 0 0 2 1 1 3 2 1T 4 3 10 5 6 1T0 6 7 1T1 7 8 10T 8 10 101 9 17 1T0T 10 19 1T01 11 20 1T1T 12 21 1T10 13 24 10T0 14 25 10T1 15 29 101T 16 30 1010
Links
- Rémy Sigrist, Table of n, a(n) for n = 0..8191
Programs
-
PARI
is(n) = { while (n, my (d = centerlift(Mod(n, 3))); n = (n-d)/3; if (d==centerlift(Mod(n, 3)), return (0););); return (1); }
-
PARI
a(n) = { my (d = binary(n)); for (i = 2, #d, d[i] = setminus([-1,0,1], [d[i-1]])[1+d[i]];); fromdigits(d, 3); }
Comments