Documentation
¶
Index ¶
- func AppendNumbers(first uint64, second uint64) uint64
- func ArePandigitalCombined(a, b uint) bool
- func ArePandigitalTogether(numbers ...int) bool
- func ArraySum(array []int) int
- func BigPow(n int64, exp int64) *big.Int
- func DisplayElapsedTime(start time.Time)
- func Factorial(number interface{}) (result int64)
- func FactorialFloat64(value float64) (result float64)
- func FactorialUint64(value uint64) (result uint64)
- func Gcd(a, b uint64) uint64
- func GeneratePrimes(limit int)
- func GetDigits(source interface{}) (result []byte)
- func GetDigitsASCII(source interface{}) (result []byte)
- func GetDivisors(number int) []int
- func GetPrimeFactors(number interface{}) (int, *list.List)
- func GetProperDivisors(number int) []int
- func GetTruncations(n int) []int
- func IsPalindromicForBase(number uint64, base int) bool
- func IsPandigital(number interface{}, panMin, panMax int) bool
- func IsPentagonal(number interface{}) bool
- func IsPrime(n uint64) bool
- func IsTriangularNumber(v interface{}) bool
- func LeftShifts(n uint64) []uint64
- func NthPermutationOfDigits(number interface{}) (result string)
- func NumberDigits(n uint64) (result int)
- func Permutations(a []rune, f func([]rune))
- func PythagoreanTripletsForPerimeter(p uint64) (*list.List, bool)
- func ReverseString(s string) string
- func SwapBytesAt(s []byte, i, j int)
- type Factor
- type PrimeGenerator
- type Primes
- type Triplet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendNumbers ¶
AppendNumbers appends 2 numbers concat
func ArePandigitalCombined ¶
ArePandigitalCombined true if all three 1..9
func ArePandigitalTogether ¶
ArePandigitalTogether true if all parameters together include exactly 1..9
func DisplayElapsedTime ¶
DisplayElapsedTime displays time since start
func FactorialFloat64 ¶
FactorialFloat64 float64 factorial
func FactorialUint64 ¶
FactorialUint64 uint64 factorial
func GetDigitsASCII ¶
func GetDigitsASCII(source interface{}) (result []byte)
GetDigitsASCII same as GetDigits but converts them all to ascii
func GetDivisors ¶
GetDivisors creates a list of divisors for number
func GetPrimeFactors ¶
GetPrimeFactors creates a list of Factor struct elements for number
func GetProperDivisors ¶
GetProperDivisors creates a list/slice of properdivisors for number
func GetTruncations ¶
GetTruncations returns array of all truncations of n, including n Ex 3797, 797, 97, 379, 37, 7, 3.
func IsPalindromicForBase ¶
IsPalindromicForBase returns true if number is palondromic in base
func IsPandigital ¶
IsPandigital true if number has exactly 1 digit from panMin..panMax
func IsTriangularNumber ¶
func IsTriangularNumber(v interface{}) bool
IsTriangularNumber bool optimized from comment in https://www.mathblog.dk/project-euler-42-triangle-words/
func NthPermutationOfDigits ¶
func NthPermutationOfDigits(number interface{}) (result string)
NthPermutationOfDigits makes //TODO: pass digits array in
func Permutations ¶
Permutations calls f with each permutation of a.
func PythagoreanTripletsForPerimeter ¶
PythagoreanTripletsForPerimeter returns List of triplets
func ReverseString ¶
ReverseString reverses s based on https://github.com/golang/example/blob/master/stringutil/reverse.go
Types ¶
type PrimeGenerator ¶
type PrimeGenerator struct {
// contains filtered or unexported fields
}
PrimeGenerator is for primes
func NewPrimeGenerator ¶
func NewPrimeGenerator(limit int) *PrimeGenerator
NewPrimeGenerator makes a new one
func (*PrimeGenerator) IsPrime ¶
func (generator *PrimeGenerator) IsPrime(value int) bool
IsPrime returns if value is prime
func (*PrimeGenerator) NextPrime ¶
func (generator *PrimeGenerator) NextPrime(next int) int
NextPrime returns next prime
func (*PrimeGenerator) NumPrimes ¶
func (generator *PrimeGenerator) NumPrimes() int
NumPrimes returns size
func (*PrimeGenerator) PrevPrime ¶
func (generator *PrimeGenerator) PrevPrime(prev int) int
PrevPrime returns previous prime