login
This site is supported by donations to The OEIS Foundation.

 

Logo

The OEIS is looking to hire part-time people to help edit core sequences, upload scanned documents, process citations, fix broken links, etc. - Neil Sloane, njasloane@gmail.com

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A065363 Sum of balanced ternary digits in n. Replace 3^k with 1 in balanced ternary expansion of n. 14
0, 1, 0, 1, 2, -1, 0, 1, 0, 1, 2, 1, 2, 3, -2, -1, 0, -1, 0, 1, 0, 1, 2, -1, 0, 1, 0, 1, 2, 1, 2, 3, 0, 1, 2, 1, 2, 3, 2, 3, 4, -3, -2, -1, -2, -1, 0, -1, 0, 1, -2, -1, 0, -1, 0, 1, 0, 1, 2, -1, 0, 1, 0, 1, 2, 1, 2, 3, -2, -1, 0, -1, 0, 1, 0, 1, 2, -1, 0, 1, 0, 1, 2, 1, 2, 3, 0, 1, 2, 1, 2, 3, 2, 3, 4, -1, 0, 1, 0, 1, 2, 1, 2, 3, 0, 1, 2, 1, 2 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,5

COMMENTS

Notation: (3)<n>(1)

Extension to negative n: a(-n) = -a(n). - Franklin T. Adams-Watters, May 13 2009

a(n) = A134024(n) - A134022(n). - Reinhard Zumkeller, Dec 16 2010

LINKS

Reinhard Zumkeller, Table of n, a(n) for n = 0..10000

F. T. Adams-Waters, F. Ruskey, Generating Functions for the Digital Sum and Other Digit Counting Sequences, JIS 12 (2009) 09.5.6

Daniel Forgues, Table of n, a(n) for n = 0..100000

FORMULA

G.f. 1/(1-x)*Sum_{k >= 0} (x^3^k-x^(2*3^k))/(x^((3^k-1)/2)*(1+x^3^k+x^(2*3^k))). - Franklin T. Adams-Watters, May 13 2009

EXAMPLE

5 = + 1(9) - 1(3) - 1(1) -> +1 - 1 - 1 = -1 = a(5).

MATHEMATICA

balTernDigits[0] := {0}; balTernDigits[n_/; n > 0] := Module[{unParsed = n, currRem, currExp = 1, digitList = {}, nextDigit}, While[unParsed > 0, If[unParsed == 3^(currExp - 1), digitList = Append[digitList, 1]; unParsed = 0, currRem = Mod[unParsed, 3^currExp]/3^(currExp - 1); nextDigit = Switch[currRem, 0, 0, 2, -1, 1, 1]; digitList = Append[digitList, nextDigit]; unParsed = unParsed - nextDigit * 3^(currExp - 1)]; currExp++]; digitList = Reverse[digitList]; Return[digitList]]; balTernDigits[n_/; n < 0] := (-1)balTernDigits[Abs[n]]; Table[Plus@@balTernDigits[n], {n, 0, 108}] (* Alonso del Arte, Feb 25 2011 *)

terVal[lst_List] := Reverse[lst].(3^Range[0, Length[lst] - 1]); maxDig = 4; t = Table[0, {3 * 3^maxDig/2}]; t[[1]] = 1; Do[d = IntegerDigits[Range[0, 3^dig - 1], 3, dig]/.{2 -> -1}; d = Prepend[#, 1]&/@d; t[[terVal/@d]] = Total/@d, {dig, maxDig}]; Prepend[t, 0] (* T. D. Noe, Feb 24 2011 *)

CROSSREFS

Cf. A065364, A053735. See A134452 for iterations.

Sequence in context: A283144 A098381 A030372 * A119995 A062756 A272728

Adjacent sequences:  A065360 A065361 A065362 * A065364 A065365 A065366

KEYWORD

base,easy,sign,look

AUTHOR

Marc LeBrun, Oct 31 2001

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy .

Last modified May 30 00:42 EDT 2017. Contains 287304 sequences.