Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » sci.math.* » sci.math.independent

Topic: JS coding
Replies: 27   Last Post: Feb 24, 2013 6:17 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Virgil

Posts: 7,025
Registered: 1/6/11
Re: JS coding
Posted: Feb 3, 2013 5:33 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

In article
<6e315bac-9f19-4cee-ad90-7ec7bbe8b5bb@w7g2000yqo.googlegroups.com>,
JT <jonas.thornvall@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)
--





Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.