Discover Packages
github.com/erikbryant/util-golang
util
package
Version:
v0.0.7
Opens a new window with list of versions in this module.
Published: Jan 6, 2024
License: MIT
Opens a new window with license information.
Imports: 4
Opens a new window with list of imports.
Imported by: 1
Opens a new window with list of known importers.
Jump to ...
README
Documentation
Index
Constants
Variables
Functions
Convergent(n, fn)
Cryptoquip(w1, w2)
DigitSum(n)
DigitsToInt(digits)
Divisors(n)
E(n)
Equal(a, b)
Factors(n)
FactorsCounted(n)
GCD(a, b)
Harshad(n, sum)
IntToDigits(n)
IsAnagram(w1, w2)
IsCube(n)
IsDigitPermutation(a, b)
IsInt(n)
IsPalindromeInt(p)
IsPalindromeString(p)
IsSquare(n)
LCM(a, b)
MakeDigits(n, c)
MulFraction(n1, d1, n2, d2)
PascalTriangle(max)
ReduceFraction(n, d)
Reverse(digits)
Sqrt2(n)
SquareFree(n)
SumFraction(n1, d1, n2, d2)
Totient(n)
Types
Source Files
README
README
¶
Utility package
English -> Pig Latin Translation Rules
A word with no characters is unchanged.
If a word begins with a vowel sound, do not shift the letters. Note that "xr" and "yt" at the beginning of a word make vowel sounds (e.g. "xray" -> "xrayay", "yttria" -> "yttriaay"). Add 'way' to the end of the word.
If a word begins with a consonant sound, move it to the end of the word. Consonant sounds can be made up of multiple consonants, such as the "ch" in "chair" or "st" in "stand" (e.g. "chair" -> "airchay"). If a word starts with a consonant sound followed by "qu", also move the 'u' to the end of the word (e.g. "square" -> "aresquay"). Add 'ay' to the end of the word.
If a word contains a "y" after a consonant cluster or as the second letter in a two letter word the 'y' makes a vowel sound (e.g. "rhythm" -> "ythmrhay", "my" -> "ymay").
Expand ▾
Collapse ▴
Documentation
¶
func Convergent(n int, fn convergentSeries) (*big.Int, *big.Int)
func Cryptoquip(w1, w2 string) (map[byte]byte, bool)
func DigitSum(n int) (sum int)
func DigitsToInt(digits []int) int
func Divisors(n int) []int
func E(n int) int64
func Equal(a, b []int) bool
func Factors(n int) []int
func FactorsCounted(n int) map[int]int
func GCD(a, b int) int
func Harshad(n, sum int) bool
func IntToDigits(n int) []int
func IsAnagram(w1, w2 string) bool
func IsCube(n int) bool
func IsDigitPermutation(a, b int) bool
func IsInt(n float64) bool
func IsPalindromeInt(p []int) bool
func IsPalindromeString(p string) bool
func IsSquare(n int) bool
func LCM(a, b int) int
func MakeDigits(n int, c chan []int)
func MulFraction(n1, d1, n2, d2 int) (int, int)
func PascalTriangle(max int) [][]int
func ReduceFraction(n, d int) (int, int)
func Reverse(digits []int) []int
func Sqrt2(n int) int64
func SquareFree(n int) bool
func SumFraction(n1, d1, n2, d2 int) (int, int)
func Totient(n int) int
Convergent returns the nth convegence of whichever series you pass in a function for
Cryptoquip returns true if the letter arrangements are similar; e.g., KEEP and LOOT
func DigitSum(n int ) (sum int )
DigitSum returns the sum of the digits in the number
func DigitsToInt(digits []int ) int
DigitsToInt converts a slice of digits to an int
Divisors returns a sorted list of all positive divisors of n
E returns the nth number (1-based) in the convergent series of e
Equal returns true if the two slices have identical contents
Factors returns a sorted list of the unique prime factors of n (excluding n)
FactorsCounted returns counts of how many times each factor divides into n
GCD returns the greatest common divisor of a and b
Harshad returns true if n is divisible by the sum of its digits
IntToDigits converts an int into a slice of its component digits
IsAnagram returns true if w1 and w2 are anagrams of each other
IsCube returns true if n is a cube number
func IsDigitPermutation(a, b int ) bool
IsDigitPermutation returns whether the two numbers are digit permutations of each other
IsInt returns true if n is an integer
IsPalindromeInt returns true if the digits of p are a palindrome
IsPalindromeString returns true if the string is a palindrome
IsSquare returns true if n is a square number
LCM returns the least common multiple of a and b
func MakeDigits(n int , c chan []int )
MakeDigits generates all permutations of the first n digits
func MulFraction(n1, d1, n2, d2 int ) (int , int )
MulFraction returns the product of the two fractions, still in fraction form
func PascalTriangle(max int ) [][]int
PascalTriangle returns a triangle of the max depth specified
func Reverse(digits []int ) []int
Reverse reverses the order of the elements in a slice
Sqrt2 returns the nth number (1-based) in the convergent series of root 2
SquareFree returns true if no square of a prime divides n
func SumFraction(n1, d1, n2, d2 int ) (int , int )
SumFraction returns the sum of the two fractions, still in fraction form
Totient returns how many numbers k are relatively prime to n
Source Files
¶
Click to show internal directories.
Click to hide internal directories.