Example #1
0
func IsGoldbach(n uint32) bool {
	bound := mathutil.ISqrt(n/2) + 1
	for i := uint32(1); i < bound; i++ {
		if _, ok := primes[n-2*i*i]; ok {
			return true
		}
	}
	return false
}
Example #2
0
func main() {

	minmax(100, 77)
	fmt.Println("ISqrt 65535 = ", mathutil.ISqrt(65535))
	fmt.Println("Log2 70000 = ", mathutil.Log2Uint32(70000))
	fmt.Println("BitLen 70 =", mathutil.BitLen(70))
	fmt.Println("BitLen 700 =", mathutil.BitLen(700))
	fmt.Println("BitLen 7000 =", mathutil.BitLen(7000))
	fmt.Println("BitLen 70000 =", mathutil.BitLen(70000))
	fmt.Println("PopCount 70000 = ", mathutil.PopCount(70000))
	fmt.Println("PopCount 70001 = ", mathutil.PopCount(70001))

}