A package to pretty print sequences of digits.
While this package is meant to work with the data structures github.com/keep94/sqrt, it will work with anything that implements the required interfaces.
package main
import (
"github.com/keep94/numprint"
"github.com/keep94/sqrt"
)
func main() {
// Pretty print the first 1000 digits of the square root of 2.
numprint.Write(sqrt.Sqrt(2).WithEnd(1000))
}Which outputs:
0 14142 13562 37309 50488 01688 72420 96980 78569 67187 53769
50 48073 17667 97379 90732 47846 21070 38850 38753 43276 41572
100 73501 38462 30912 29702 49248 36055 85073 72126 44121 49709
150 99358 31413 22266 59275 05592 75579 99505 01152 78206 05714
200 70109 55997 16059 70274 53459 68620 14728 51741 86408 89198
250 60955 23292 30484 30871 43214 50839 76260 36279 95251 40798
300 96872 53396 54633 18088 29640 62061 52583 52395 05474 57502
350 87759 96172 98355 75220 33753 18570 11354 37460 34084 98847
400 16038 68999 70699 00481 50305 44027 79031 64542 47823 06849
450 29369 18621 58057 84631 11596 66871 30130 15618 56898 72372
500 35288 50926 48612 49497 71542 18334 20428 56860 60146 82472
550 07714 35854 87415 56570 69677 65372 02264 85447 01585 88016
600 20758 47492 26572 26002 08558 44665 21458 39889 39443 70926
650 59180 03113 88246 46815 70826 30100 59485 87040 03186 48034
700 21948 97278 29064 10450 72636 88131 37398 55256 11732 20402
750 45091 22770 02269 41127 57362 72804 95738 10896 75040 18369
800 86836 84507 25799 36472 90607 62996 94138 04756 54823 72899
850 71803 26802 47442 06292 69124 85905 21810 04459 84215 05911
900 20249 44134 17285 31478 10580 36033 71077 30918 28693 14710
950 17111 16839 16581 72688 94197 58716 58215 21282 29518 48847
More documentation and examples can be found here.