Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Convert integers to and from balanced ternary
ResourceFunction["BalancedTernary"][n] toggles the n between integer and balanced ternary format. |
Convert some integers to balanced ternary format:
In[1]:= |
![]() |
Out[1]= |
![]() |
Convert the balanced ternary numbers back into integers:
In[2]:= |
![]() |
Out[2]= |
![]() |
Large numbers can be converted into balanced ternary:
In[3]:= |
![]() |
Out[3]= |
![]() |
Create a random 20-digit balanced ternary number:
In[4]:= |
![]() |
Out[4]= |
![]() |
Convert to an integer:
In[5]:= |
![]() |
Out[5]= |
![]() |
Using weights of size 1, 3, 9 and 27 and a 2-sided balance, measure weights 1 to 20:
In[7]:= |
![]() |
Out[7]= |
![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License