MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: FromDigits[{135,21}] -> 1371 (??!!)

On 1/25/05 at 5:03 AM, seidovzf at (Zak Seidov) wrote:

>Can anyone please explain what happens, if "Digits" actually are
>FromDigits[{3,2}] 32(!) 


>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}]]

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]
To reply via email subtract one hundred and four

  • Prev by Date: Re: DSolve with recursively defined equations
  • Next by Date: Re: Why IntervalBisection can't operate on InterpolatingFunction
  • Previous by thread: Re: FromDigits[{135,21}] -> 1371 (??!!)
  • Next by thread: Re: Re: FromDigits[{135,21}] -> 1371 (??!!)