Re: FromDigits[{135,21}] -> 1371 (??!!)
- To: mathgroup at smc.vnet.net
- Subject: [mg53795] Re: FromDigits[{135,21}] -> 1371 (??!!)
- From: Bill Rowe <readnewsciv at earthlink.net>
- Date: Thu, 27 Jan 2005 05:41:43 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
On 1/25/05 at 5:03 AM, seidovzf at yahoo.com (Zak Seidov) wrote:
>Can anyone please explain what happens, if "Digits" actually are
>"integers":
>FromDigits[{3,2}] 32(!)
<snip>
>it's OK above, but:
>FromDigits[{135,21}] 1371 (??!!)
By default, FromDigits assumes base 10 and computes 10*135+21 = 1371
>And how to get integer 1323 from list {13,23}?
There are several ways. First convert each element of the list to individual digits, combine the lists and send to FromDigits, i.e.,
FromDigits[Flatten[IntegerDigits /@ {13, 23}]]
1323
But the more elegant approach is to take advantage of the fact FromDigits can be made to work with any base. In particular,
FromDigits[{13, 23}, 100]
1323
--
To reply via email subtract one hundred and four