OFFSET
1,3
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
A. V. Kitaev, Meromorphic Solution of the Degenerate Third Painlevé Equation Vanishing at the Origin, arXiv:1809.00122 [math.CA], 2018.
FORMULA
Numbers that in ternary are the concatenation of i 1's with j 2's, i, j>=0. Also a(n) = A073216(n+1) - 1. Proof: Write a(n) as 1{m}2{n}, then adding 1 gives 1{m-1}20{n} for m>0 and 10{n} for m=0. Doubling yields 10{m-1}10{n} or 20{n}, respectively. These two forms exactly describe the forms of sums of two powers of 3, the two powers being 3^n and 3^(m+n). - Hugo van der Sanden
EXAMPLE
In base 3 these numbers are 0, 1, 2, 11, 12, 22, 111, 112, 122, 222, 1111, 1112, ... [corrected by Sean A. Irvine, Jun 10 2019]
MATHEMATICA
Select[Range[0, 10000], !Negative[Min[Differences[IntegerDigits[ #, 3]]]]&] (* or *) With[{nn=10}, FromDigits[#, 3]&/@Union[Flatten[Table[ PadRight[ PadLeft[{}, n, 1], x, 2], {n, 0, nn}, {x, 0, nn}], 1]]] (* Harvey P. Dale, Oct 12 2011 *)
Select[Range[0, 10000], LessEqual@@IntegerDigits[#, 3]&] (* Ray Chandler, Jan 06 2014 *)
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
EXTENSIONS
Change offset to 1 by Ray Chandler, Jan 06 2014
STATUS
approved