Closed Thread Icon

Topic awaiting preservation: Decimal to trinary conversion (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=7045" title="Pages that link to Topic awaiting preservation: Decimal to trinary conversion (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Decimal to trinary conversion <span class="small">(Page 1 of 1)</span>\

 
viol
Maniac (V) Inmate

From: Charles River
Insane since: May 2002

posted posted 10-13-2003 06:19

Yes, you read it right.
Everybody is used to converting from decimal (base 10) to binary (base 2), it's easy because we can use bit shift etc.
But I need to convert a decimal to "trinary", I mean, base 3:
0 = 000
9 = 100
20 = 202
26 = 222
and so on.
This is NOT a homework. This is a routine that I'll use to test the results of another routine. This another routine is the one that's my homework.

viol
Maniac (V) Inmate

From: Charles River
Insane since: May 2002

posted posted 10-13-2003 07:37

Forget it.
I managed to do what I wanted. The idea of generating trinary numbers was discarded. This generates sequences of r, w and b with all possible arrangements, that's what I wanted to test my other method.

code:
public static void f(String[] color, int depth, String p)
{
if (depth == 0)
{
System.out.println(p);
// here goes the testing ...
return;
}
String q = p;
for (int i = 0; i < 3; i++)
{
q = p + color[i];
f(color, depth - 1, q);
}
}

which I use with this:

public static void main(String[] args)
{
String[] c = {"r", "w", "b"};
f(c, 3, "");
}



InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 10-13-2003 08:20

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

viol
Maniac (V) Inmate

From: Charles River
Insane since: May 2002

posted posted 10-13-2003 08:35

That would have been easier to code

Rameses Niblik the Third
Maniac (V) Mad Scientist

From: From:From:
Insane since: Aug 2001

posted posted 10-13-2003 14:53

What's all this Base 3 and Base 10 stuff about? If it's algebraic math, don't bother explaining.

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 10-13-2003 15:00

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

warjournal
Maniac (V) Mad Scientist

From:
Insane since: Aug 2000

posted posted 10-13-2003 15:25

my bad nothing to add


[This message has been edited by warjournal (edited 10-13-2003).]

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 10-13-2003 15:35

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 10-13-2003 15:59

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

warjournal
Maniac (V) Mad Scientist

From:
Insane since: Aug 2000

posted posted 10-13-2003 16:35

Damn you, InI. After some thought, I felt that this isn't the time or place for it.
I'll try and find some old post links for you and e-mail 'em.

edit: Might take awhile. Looks like the archives are broken. Man, now I'll have to e-mail the admin. Double damn you, InI.


[This message has been edited by warjournal (edited 10-13-2003).]

hyperbole
Paranoid (IV) Inmate

From: Madison, Indiana, USA
Insane since: Aug 2000

posted posted 10-13-2003 18:08

Actually there were computers designed to run on trinary circuits in the late 1940s and early 1950s. Engineers like the system because you could create circuits based on +V, 0, -V. It actually made storage of values more efficient than binary.

There were also computers whose circuits calcuated in decimal at that time. Donald Knuth was one of the advocates of trinary computing systems.

I don't know all the reasons we decided to use binary, but these kinds of experiments disappeared by the mid 1970s.




-- not necessarily stoned... just beautiful.

« BackwardsOnwards »

Show Forum Drop Down Menu