For educational purpuses I sometimes print out large or interesting numbers for young mathematicians participating in classes. The numbers are generated in Mathematica.

I have tried simply copying it from Mathematica to Word, but Word works awfully slow (even with grammar check off). For example, with margins set to minimum possible value, using font of size 2, number $1\,000\,000!$ takes 33 pages.

So I want to export it to PDF file, but the problem is that using just Export command gives one-page PDF with three dots at the end of each line, and I don't have the option to set the font size. So, it is not really what you can call a beautiful and gripping thing.

I would also appreciate a hint on "interesting" formatting of the number, like making the first several lines with normal font and then lowering it, or highlighting some digits, for example, all $2$-s in the decimal form.


One way would be to split the large number in smaller chunks, convert each of them to a string, which can be manipulated, and then exporting.

bigNumber = 10000!;
output = (StringJoin @@ #) & /@ Partition[ToString[#] & /@ IntegerDigits[bigNumber], 
        40, 40, {1, -1}] ; (* each line has 40 digits *)

(* Make font smaller and red for all lines except the first 5 *)
export = Join[output[[1 ;; 5]], Style[#, Small, Red] & /@ output[[6 ;;]] ] // TableForm

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.