Search This Blog

10 September 2005

Balanced Ternary

While looking at whether it would be interesting to use Balanced Ternary for solving Primes, I was looking over my tutorial I wrote a few years ago (link above) and then did a search. I found this page that had a very interesting observation...

Date: 04/08/2002 at 11:41:19
From: Thomas
Subject: Weird base three

Hello Dr. Peterson,

First of all thank you for your prompt answer to my math problem. I
followed your advice and made a table using base 3 for the numbers -5
to 35. I noticed a pattern. The column of the 1s follows 1, -1 0. The
column of the 3s: 1,1,1, -1,-1,-1, 0, 0,0. The column of the 9s has
nine 1s, nine -1s, and nine 0s. Consequently the next column, which is
the column of the 27s, will have 27 ones, 27 -1s, and 27 0s.


What they are saying is this...
bit0 follows the pattern 0+-0+-0+-
bit1 follows the pattern 000+++---000+++--- (note that the first + is actually number 2, so leading 0's don't have initial 0)
bit2 follows the pattern 000000000+++++++++--------- etc (first + is actually number 5, so leading 0's don't have initial four 0s)
bit3 follows the same pattern, but 27 of each -- starting with first + at 14

so, to clarify...
bit0: [0][+][-] repeat
bit1: [3*0][3*+][3*-] repeat
bit2: [9*0][9*+][9*-] repeat
bit3: [27*0][27*+][27*-] repeat

how do we clarify where the initial '+' would be?
bit0: skip 0
bit1: skip 1
bit2: skip 4
bit3: skip 13

f(x)? except for bit0, the # we are skipping, times itself, plus 1 = the number of the repeat
more specifically, we are repeating the pattern of: 3^bit, and the number to skip = ((3^bit - 1)/2)
so..
bit0: ((3^0-1)/2)=0/2=0 [if the computer didn't give a crash]
bit1: ((3^1-1)/2)=3/2=1
bit2: ((3^2-1)/2)=9/2=4
bit3: ((3^2-1)/2)=27/2=13
etc

so...
we are skipping the first half of each repeat (round down to nearest whole number), where each repeat is 3^bit...

what does this mean? it means we could generate an entire table without doing any math, any calculations, etc -- OTHER THAN doing 3^bit and /2.

pattern = (3^bit)0s followed by (3^bit)+s followed by (3^bit)-s; skipping the first 1/2

No comments:

Post a Comment