Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2001
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2001

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

Search the Archive

Re: Printing Large Base-n Numbers

  • To: mathgroup at smc.vnet.net
  • Subject: [mg29901] Re: Printing Large Base-n Numbers
  • From: "Martin Harborth" <martin.harborth at ts.siemens.de>
  • Date: Wed, 18 Jul 2001 02:08:44 -0400 (EDT)
  • Organization: Siemens AG, ATD TD IT MV 1
  • References: <9imc9t$ev7$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

You can display a 16-base number with the ToString-Function. Here is a
sample notebook:

In[126]:=
p =
11354882100554070846945886900376612381887314805411070198522440388172296396\
4066445293488918726487884165751915105884395208557100959738769115073161568342
54\
673;

In[127]:=
displayHexNumber[p_Integer] := Module[{a, b, c},
    a = ToString[BaseForm[p, 16]];
    b = StringPosition[a, " "];
    c = {b[[1, 1]], b[[Length[b], 2]]};
    StringDrop[a, c]]

In[128]:=
displayHexNumber[p]

Out[128]=
"d8cd81f035ec57efe822955149d3bff70c53520d769d6d76646c7a792e16ebd89fe6fc5b606
b5\
6f63eb11317a8dccdf203650ef28d0cb9a6d2b2619c52480f51\n16"


<Flip at safebunch.com> schrieb im Newsbeitrag
news:9imc9t$ev7$1 at smc.vnet.net...
> Hi All,
>
> when converting bases for large numbers, such as:
>
> p =
11354882100554070846945886900376612381887314805411070198522440388172296396\
>
4066445293488918726487884165751915105884395208557100959738769115073161568342
54\
> 673;
>
> BaseForm[p, 16]
>
> The output of baseform is a long (with no wrapping) string.  When one
prints
> this out, it gets cut off of the page.
>
> Is there a way to be able to see the hex (and actually treat it is a
number do
> you can print results) output as a nicely formatted hex number?
>
> (My main concern is to printout results for the audience).
>
> Thank you for any input ... Wilson
>
>




  • Prev by Date: Re: Capability of Mathematica
  • Next by Date: Re: weighting CA neighbors by distance
  • Previous by thread: Printing Large Base-n Numbers
  • Next by thread: Head found ;-)