# How cut any integer number?

I have this output:

(323909701210368 Sqrt[3] t^(56/3))/(11 Gamma[2/3] Gamma[59/3]) + (
23266815064996478976000 t^(71/3))/(Gamma[2/3] Gamma[74/3])

I want to have numbers just with 3 digits. For example:

(323 Sqrt[3] t^(56/3))/(11 Gamma[2/3] Gamma[59/3]) + (
232 t^(71/3))/(Gamma[2/3] Gamma[74/3])

Any suggestion?

-

## 2 Answers

A truly weird question! I cant imagine why you would want to do that but here goes..

f[i_] := FromDigits[IntegerDigits[i][[;; 3]]];
((323909701210368 Sqrt[3] t^(56/3))/(11 Gamma[2/3] Gamma[
59/3]) + (23266815064996478976000 t^(71/3))/(Gamma[2/3] Gamma[
74/3])) /.
{Rational[x_Integer /; x > 1000, y_] :> f[x]/y, x_Integer /; x > 1000 :> f[x]}

(323*Sqrt[3]*t^(56/3))/(11*Gamma[2/3]*Gamma[59/3]) + (232*t^(71/3))/(Gamma[2/3]*Gamma[74/3])

-
maybe x>999 instead of x>1000? – AccidentalFourierTransform Mar 29 at 17:12
Many many thanks. – user37694 Mar 29 at 20:32

This goes and modifies the displayed box form. Please note that this is not meant to be used as input to other computations, just for display - so it's similar to MatrixForm in that sense.

ClearAll[ShortIntegerForm];

ShortIntegerForm[expr_] :=
ToBoxes@expr /.
n_String /;
StringMatchQ[n, Repeated[DigitCharacter, {4, \[Infinity]}]] :>
Tooltip[StringJoin[StringTake[n, 3],
"\[InvisibleSpace]\[Ellipsis]"], ToExpression@n] // DisplayForm

Now you can apply this form to your expression:

(323909701210368 Sqrt[3] t^(56/3))/(11 Gamma[2/3] Gamma[
59/3]) + (23266815064996478976000 t^(71/3))/(Gamma[2/3] Gamma[
74/3]) // ShortIntegerForm

As an added bonus, Tooltip shows the full value if you take your mouse pointer over the short form.

-