func poorPigs(buckets int, minutesToDie int, minutesToTest int) int { base := minutesToTest/minutesToDie + 1 // Status of a pig: die at x min or still alive // So the number of pigs is log(buckets)/log(base) return int(math.Ceil(math.Log(float64(buckets)) / math.Log(float64(base)))) }