OFFSET
0,4
MATHEMATICA
Table[Length@ # - 2 First@ FirstPosition[#, k_ /; k != 2] + 1 &@ Map[First@ IntegerDigits[#, 3] &, #] &@ NestWhileList[# - Total@ IntegerDigits[#, 3] &, 3^(n + 1) - 1, # > 3^n - 1 &], {n, 0, 16}] (* Michael De Vlieger, Jun 27 2016, Version 10 *)
CROSSREFS
KEYWORD
sign
AUTHOR
Antti Karttunen, Aug 16 2015
EXTENSIONS
Terms a(24) & a(25) from Antti Karttunen, Jun 27 2016
STATUS
approved