Comments on Balanced quinary quasiquine
Post
Balanced quinary quasiquine
Given an integer
Terminology
Quinary
Standard quinary (baseFor example, the quinary number
Balanced quinary
Balanced quinary works exactly the same as standard quinary, except it uses digits worthFor the following example we will use
For example, the balanced quinary number
Input
- The input will be an integer in balanced quinary
- You may choose any
characters to represent the digits of balanced quinary - As these digits do not necessarily have to be numeric characters, you are free to choose between taking input as a numeric type, or as a string, including any ordered data structure of characters
- The input will never have leading zeroes
- The input may correspond to a value larger in magnitude (absolute value) than the number of characters in your source code
- The input will never be empty (zero is represented in balanced quinary as the digit
)
Output
For input that evaluates to
- If
is positive, the output is the first characters of your source code - If
is negative, the output is the last characters of your source code - If the magnitude (absolute value) of
is greater than the number of characters in your source code, the output consists of your entire source code - The required characters of your source code must be output in order
- Specifically, if
is negative, the last characters must not be in reversed order.
If your source code isQUINTESSENTIAL
the last characters areESSENTIAL
, notLAITNESSE
- Specifically, if
- The output may include an optional trailing newline
- If
the output must be empty (apart from the optional trailing newline)
Excluded trivial cases
Using source code of length
Detailed justification
Source code with lengthIn order to demonstrate that it is correctly interpreting the balanced quinary base system (not just the individual digits), your code must have at least
The smallest magnitude of a
Test cases
These test cases use
The test cases are in the format
quinary input : decimal equivalent : "output characters"
The output characters are based on your source code being the string QUINTESSENTIAL
and the double quotes do not form part of the output (they just make empty output easier to read for these test cases).
0 : 0 : ""
Z : -1 : "L"
1 : 1 : "Q"
Y : -2 : "AL"
2 : 2 : "QU"
Z2 : -3 : "IAL"
1Y : 3 : "QUI"
Z1 : -4 : "TIAL"
1Z : 4 : "QUIN"
Z0 : -5 : "NTIAL"
10 : 5 : "QUINT"
1000 : 125 : "QUINTESSENTIAL"
Z000 : -125 : "QUINTESSENTIAL"
Scoring
This is a code golf challenge. Your score is the length of your source code in bytes. Lower is better.
Note that your score is in bytes, but the required length of output is measured in characters, in case the two are not equivalent for your chosen language.
Explanations are optional, but I'm more likely to upvote answers that have one.
2 comment threads