Re: balanced ternary arithmetic

*To*: mathgroup at smc.vnet.net*Subject*: [mg31384] Re: [mg31376] balanced ternary arithmetic*From*: Ken Levasseur <Kenneth_Levasseur at uml.edu>*Date*: Wed, 31 Oct 2001 19:59:04 -0500 (EST)*References*: <200110310831.DAA26481@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Karl: I don't know of a package that does this, but here is code that I recently wrote for a course I'm teaching. Ken Levasseur Math. Sci. UMass Lowell In[1]:= tern[0]={0}; tern[1]={1};tern[-1]={-1}; In[2]:= tern[k_]:=tern[k]=Join[ tern[Quotient[k,3,-1]],tern[Mod[k,3,-1]]] In[3]:= tern[2] Out[3]= {1, -1} In[4]:= tern[100] Out[4]= {1, 1, -1, 0, 1} In[5]:= tern[-32] Out[5]= {-1, -1, 1, 1} Karl D'Adamo wrote: >Does anyone know of any packages available that can express numbers in >balanced ternary notation? The BaseForm function can do regular base 3, >but I want to use -1,0,1 > >Thanks. > > >

**References**:**balanced ternary arithmetic***From:*"Karl D'Adamo" <karld@ugcs.caltech.edu>