Documentation
¶
Index ¶
- Constants
- func Abs(n int) int
- func Distinct(a []int) (r []int)
- func Factorial(n int) int
- func GCD(a ...int) int
- func GCD2(m, n int) int
- func Insert(a []int, index int, value int) []int
- func IsPrime(n int) bool
- func Max(a ...int) int
- func Max2(a, b int) int
- func Memset(a []int, value int)
- func Min(a ...int) int
- func Min2(a, b int) int
- func MinMax(a ...int) (int, int)
- func MinMax2(a, b int) (int, int)
- func Mul(a ...int) int
- func Primes(max int) []int
- func Remove(a []int, index int) []int
- func Reverse(a []int)
- func Sum(a ...int) int
- func Thousands(n int) string
- func TimeRun(f func()) time.Duration
Constants ¶
View Source
const ( // KB is kilobyte and equal to 1024 which is 11bit. KB = 1 << (iota * 10) // MB is megabyte and equal to 1024 KB=1048576 which is 21bit. MB = 1 << (iota * 10) // GB is gigabyte and equal to 1024 MB=1073741824 which is 31bit. GB = 1 << (iota * 10) // TB is terabyte and equal to 1024 GB=1099511627776 which is 41bit. TB = 1 << (iota * 10) // PB is petabyte and equal to 1024 TB=1125899906842624 which is 51bit. PB = 1 << (iota * 10) // EB is exabyte and equal to 1024 PB=1152921504606846976 which is 61bit. EB = 1 << (iota * 10) // ZB is zettabyte and equal to 1024 EB=1180591620717411303424 which is 71bit. ZB = 1 << (iota * 10) // YB is yottabyte and equal to 1024 ZB=1208925819614629174706176 which is 81bit. YB = 1 << (iota * 10) )
Variables ¶
This section is empty.
Functions ¶
func Factorial ¶
Factorial returns factorial(n) n must be positive.
32 bit int: 0 <= n <= 12 otherwise panics. 12! = 479,001,600 = 0x1C8C FC00 == 29bit 13! = 6,227,020,800 = 0x1 7328 cc00 == 33bit
64 bit int:
0 <= n <= 20 otherwise panics.
20! = 2,432,902,008,176,640,000 = 0x21C3 677C 82B4 0000 == 62bit 21! = 51,090,942,171,709,440,000 = 0x2 C507 7D36 B8C4 0000 == 66bit
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package combinations provides primitives for selection of one element per row, from collections, such that (unlike permutations) the order of selection does not matter.
|
Package combinations provides primitives for selection of one element per row, from collections, such that (unlike permutations) the order of selection does not matter. |
|
examples/combination-all
command
|
|
|
examples/combination-for
command
|
|
|
primes
command
|
|
|
Package kcombinations provides primitives for selection of k items from a collection of n items, such that (unlike permutations) the order of selection does not matter.
|
Package kcombinations provides primitives for selection of k items from a collection of n items, such that (unlike permutations) the order of selection does not matter. |
|
examples/combination-all
command
|
|
|
examples/combination-for
command
|
|
|
examples/simple
command
|
|
|
Package permutations provides primitives for selection of elements for a collection permutations (ordered selection).
|
Package permutations provides primitives for selection of elements for a collection permutations (ordered selection). |
|
examples
command
|
|
|
examples/Lexicographic
command
|
|
|
examples/recursive
command
|
|
|
examples/str
command
|
|
Click to show internal directories.
Click to hide internal directories.