Date: Feb 10, 2013 11:56 AM Author: JT Subject: Re: JS coding On 6 Feb, 10:01, Virgil <vir...@ligriv.com> wrote:

> In article

> <3123c3cd-44ed-473e-a206-c9246797a...@fn10g2000vbb.googlegroups.com>,

>

>

>

>

>

>

>

>

>

> JT <jonas.thornv...@gmail.com> wrote:

> > On 3 Feb, 23:33, Virgil <vir...@ligriv.com> wrote:

> > > In article

> > > <6e315bac-9f19-4cee-ad90-7ec7bbe8b...@w7g2000yqo.googlegroups.com>,

>

> > > JT <jonas.thornv...@gmail.com> wrote:

> > > > I do not want a counter, i want a general solution to re encode any

> > > > decimal number where anybase(decimal,base) {}

> > > > This is probably why people save code instead of posting it to

> > > > usenet ;D

>

> > > The process involves repeated divisions with whole number quotients and

> > > remainder

> > > Example: Convert 99 base 10 to base 8

>

> > > Step 1. 8 into 99 goes 12 times with 3 left over

> > > Step 2. 8 into 12 goes 1 time with 4 left over

> > > Step 3. 8 into 1 goes 0 times with 1 left over

> > > Stop when base goes into dividend 0 times

>

> > > Then line up the leftovers from last to first: 1,4,3

>

> > > Result 99(base 10) is 143(base 8)

>

> > > Check: 143(base 8) = 1*8^2 + 4*8^1 + 3*8^0

> > > = 1*64 + 4*8 + 3*1

> > > = 64 + 32 + 3

> > > = 99 (base 10)

> > > --

>

> > Honestly i thought that you math guys, easily could see howto convert

> > ordinary bases to zeroless NyaN bases. For me it took a week to find

> > the generic algorithm for anybase to write out any number using NyaN

> > base notation, but it was 15 years ago so it probably will take me a

> > week or two.

>

> The thing is that none of us see any point to converting to zeroless

> bases when the systems with zeroes works so well.

>

>

>

> > The annoying thing is that i know that the generic basechanger i wrote

> > for standard base was written so a single line of code could change it

> > to NyaN bases, but i am probably getting old because i think i have to

> > start all over with NyaN algorithm. When i do changes it hangs and

> > without a debugger line for line it is harder.

>

> > The generic basechanger is allready working, but how do i get it to

> > write out NyaN bases instead of standard bases.

>

> Your problem.

> --

> What is NyaN?

It is a concept of new naturals working in anybase(Nya N swedish), it

is written out without zeros.

BASE 3 BELOW

Dec = NyaNTern=StandardTern

1 =1 01

2 =2 02

3 =3 10

4 =11 3+1 11

5 =12 3+2 12

6 =13 3+3 20

7 =21 6+1 21

8 =22 6+2 22

9 =23 6+3 100

10 =31 9+1 101

11 =32 9+2 102

12 =33 9+3 110

13 =111 9+3+1 111

14 =112 9+3+2 112

15 =113 9+3+3 120

16 =121 9+6+1 121

17 =122 9+6+2 122

18 =123 9+6+3 200

19 =131 9+9+1 201

20 =132 9+9+2 202

21 =133 9+9+3 210

Below ternary fractions in NyaN

Paragraphs for empty preceding

entrys to keep track of multiple * bas (Ternary=1,3,9,27,81....)

Fractions = NyaN ternary fraction

1/3 = .1

2/3 = .2

1/9 = .(1)1

2/9 = .(1)2

1/27 = .(2)1

2/27 = .(2)2

1/81 = .(3)1

2/81 = .(3)2 ...