Annual Appeal: Please make a donation (tax deductible in USA) to keep the OEIS running. Over 5000 articles have referenced us, often saying "we discovered this result with the help of the OEIS".
Tersum m + n : write m and n in base 3 and add mod 3 with no carries, e.g. 5 + 8 = "21" + "22" = "10" = 1.
a(n)= -9 + Sum_{k=0..n}{(1/36)*(-59*(k mod 9)+13*((k+1) mod 9)-23*((k+2) mod 9)+13*((k+3) mod 9)+13*((k+4) mod 9)+13*((k+5) mod 9)-23*((k+6) mod 9)+13*((k+7) mod 9)+49*((k+8) mod 9)},with n>=0 - Paolo P. Lava, Dec 03 2007