Non-decimal radices/Convert: Difference between revisions
Content added Content deleted
(→{{header|Python}}: factorize) |
(J: elaborate, a bit) |
||
Line 608: | Line 608: | ||
=={{header|J}}== |
=={{header|J}}== |
||
J supports direct specification of |
J supports direct specification of integers by base. The numbers are expressed as the base to be used (using base 10), the letter b, followed by the number itself. Following the initial letter b, other (lower case) letters represent "digts" 10 (a) through 35 (z), as in these examples: |
||
<lang j> 2b100 8b100 |
<lang j> 2b100 8b100 10b_100 16b100 36b100 36bzy |
||
4 64 |
4 64 _100 256 1296 1294</lang> |
||
⚫ | |||
Additionally, J has primitives [http://www.jsoftware.com/help/dictionary/d401.htm #.] and [http://www.jsoftware.com/help/dictionary/d402.htm #:] for dealing with base conversion issues. |
|||
⚫ | |||
<lang j>numerals=: '0123456789abcdefghijklmnopqrstuvwxyz' |
<lang j>numerals=: '0123456789abcdefghijklmnopqrstuvwxyz' |
||
baseNtoL=: numerals {~ #.inv |
baseNtoL=: numerals {~ #.inv |