OFFSET
1,2
COMMENTS
Also: Numbers which, written in base 9, have only digits 0, 1 or 2, and no two adjacent digits equal. - M. F. Hasler, Feb 03 2014
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
FORMULA
From Robert Israel, Jan 29 2017: (Start)
If a(n) == 0 (mod 3) then a(2*n+1) = 9*a(n) + 1 else a(2*n+1) = 9*a(n).
If a(n) == 2 (mod 3) then a(2*n+2) = 9*a(n) + 1 else a(2*n+1) = 9*a(n)+2.
a(4k+5) = 9*a(2k+2).
(End)
MAPLE
A[1]:= [1, 2]:
for d from 2 to 6 do
A[d]:= map(t -> seq(9*t+j, j=subs(t mod 9 = NULL, [0, 1, 2])), A[d-1])
od:
seq(op(A[d]), d=1..6); # Robert Israel, Jan 29 2017
MATHEMATICA
Table[FromDigits[#, 9]&/@Select[Tuples[{0, 1, 2}, n], Min[Abs[Differences[#]]]>0&], {n, 2, 5}]// Flatten// Union (* Harvey P. Dale, May 27 2023 *)
PROG
(PARI) is_A043307(n)=(n=[n])&&!until(!n[1], ((n=divrem(n[1], 9))[2]<3 && n[1]%3!=n[2])||return) \\ M. F. Hasler, Feb 03 2014
(PARI) a(n) = my(v=binary(n+1)); v[1]=0; for(i=2, #v, v[i]+=(v[i]>=v[i-1])); fromdigits(v, 9); \\ Kevin Ryde, Mar 13 2021
CROSSREFS
KEYWORD
nonn,base
AUTHOR
STATUS
approved