OFFSET
1,1
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..2000
MATHEMATICA
Union[ Map[ Plus@@(Array[ (3^#)&, Length[ # ], 0 ]*#)&, Flatten[ Table[ Permutations[ Join[ Range[ 3-1 ], Array[ 0&, k ] ] ], {k, 0, 6} ], 1 ] ] ]
PROG
(PARI) a(n)=(1+(j(n)>=i(n)))*3^i(n)+(2-(j(n)>=i(n)))*3^(j(n)%i(n)) where i(n) = floor(1/2+sqrt(n)) and j(n) = n-1-2*binomial(i(n), 2) /* Michael Somos, Jun 03 2000 */
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
STATUS
approved