OFFSET
0,3
MATHEMATICA
nmax = 23; 3^Range[0, nmax] - Length /@ NestList[ DeleteCases[ Flatten[ Outer[ Append, #, {1, 2, 3}, 1], 1], {___, x__, x__, ___}] &, {{}}, nmax] (* Jean-François Alcover, Jun 12 2017, using Vladimir Reshetnikov's code for A006156 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Mats Granvik, Dec 18 2009
STATUS
approved