0

I have very large number. I have to operate first n digits from left.

Is there a command in Mathematica that will give n digits of a given number something like xxxxx[123456789, 5]=12345?

IntegerPart[N[number/10^n]]is generating internal errors.

Jaspreet
  • 759
  • Cast the number as a string, then find the substring over the desired length, finally casting back as a number again. ToExpression(StringPart(ToString(123456789),1;;5;;1)) – JMoravitz Apr 05 '20 at 19:52

1 Answers1

0

Try RealDigits[].

N[2000!, 50]
RealDigits[N[2000!, 50], 10]

(*  3.3162750924506332411753933805763240382811172081058*10^5735  *)
(*  {{3, 3, 1, 6, 2, 7, 5, 0, 9, 2, 4, 5, 0, 6, 3, 3, 2, 4, 1, 1, 7, 5, 3, 9, 3, 3, 8, 0, 5, 7, 6, 3, 2, 4, 0, 3, 8, 2, 8, 1, 1, 1, 7, 2, 0,   8, 1, 0, 5, 8}, 5736}  *)
Eric Towers
  • 67,037