A043089 Every string of 2 consecutive base-3 digits contains exactly 2 distinct numbers.
0, 1, 2, 3, 5, 6, 7, 10, 11, 15, 16, 19, 20, 21, 23, 30, 32, 33, 34, 46, 47, 48, 50, 57, 59, 60, 61, 64, 65, 69, 70, 91, 92, 96, 97, 100, 101, 102, 104, 138, 140, 141, 142, 145, 146, 150, 151, 172, 173, 177, 178, 181, 182, 183, 185, 192
Offset: 0
Links
- Harvey P. Dale, Table of n, a(n) for n = 0..1000
Crossrefs
Cf. A031941.
Programs
-
Mathematica
Select[Range[0,200],FreeQ[Differences[IntegerDigits[#,3]],0]&] (* Harvey P. Dale, Feb 25 2022 *)
-
PARI
a(n, base=3) = { for (b=0, oo, if (n <= (base-1)*2^b, my (v=ceil(n/2^b), p=(n-1)%(2^b)); while (b>0, v=base*v+vecsort([(v-1)%base, (v+1)%base])[1+bittest(p,b--)];); return (v), n -= (base-1)*2^b);); } \\ Rémy Sigrist, Sep 15 2022
Comments