Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Numeral system
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Generalized variable-length integers== {{main|Punycode}} More general is using a [[mixed radix]] notation (here written [[Endianness|little-endian]]) like <math>a_0 a_1 a_2</math> for <math>a_0 + a_1 b_1 + a_2 b_1 b_2</math>, etc. This is used in [[Punycode]], one aspect of which is the representation of a sequence of non-negative integers of arbitrary size in the form of a sequence without delimiters, of "digits" from a collection of 36: aβz and 0β9, representing 0β25 and 26β35 respectively. There are also so-called threshold values (<math>t_0, t_1, \ldots</math>) which are fixed for every position in the number. A digit <math>a_i</math> (in a given position in the number) that is lower than its corresponding threshold value <math>t_i</math> means that it is the most-significant digit, hence in the string this is the end of the number, and the next symbol (if present) is the least-significant digit of the next number. For example, if the threshold value for the first digit is ''b'' (i.e. 1) then ''a'' (i.e. 0) marks the end of the number (it has just one digit), so in numbers of more than one digit, first-digit range is only bβ9 (i.e. 1β35), therefore the weight ''b''<sub>1</sub> is 35 instead of 36. More generally, if ''t<sub>n</sub>'' is the threshold for the ''n''-th digit, it is easy to show that <math>b_{n+1}=36-t_n</math>. Suppose the threshold values for the second and third digits are ''c'' (i.e. 2), then the second-digit range is aβb (i.e. 0β1) with the second digit being most significant, while the range is cβ9 (i.e. 2β35) in the presence of a third digit. Generally, for any ''n'', the weight of the (''n'' + 1)-th digit is the weight of the previous one times (36 β threshold of the ''n''-th digit). So the weight of the second symbol is <math>36 - t_0 = 35</math>. And the weight of the third symbol is <math>35(36 - t_1) = 35\cdot34 = 1190</math>. So we have the following sequence of the numbers with at most 3 digits: ''a'' (0), ''ba'' (1), ''ca'' (2), ..., 9''a'' (35), ''bb'' (36), ''cb'' (37), ..., 9''b'' (70), ''bca'' (71), ..., 99''a'' (1260), ''bcb'' (1261), ..., 99''b'' (2450). Unlike a regular ''n''-based numeral system, there are numbers like 9''b'' where 9 and ''b'' each represent 35; yet the representation is unique because ''ac'' and ''aca'' are not allowed β the first ''a'' would terminate each of these numbers. The flexibility in choosing threshold values allows optimization for number of digits depending on the frequency of occurrence of numbers of various sizes. The case with all threshold values equal to 1 corresponds to [[bijective numeration]], where the zeros correspond to separators of numbers with digits which are non-zero.
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Numeral system
(section)
Add topic