Exemplo n.º 1
0
func main() {
	euler.Init(5, "What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?")
	euler.PrintTime("Index by index.     Result: %v, Nanoseconds: %d\n", lcm, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)
	euler.PrintTime("Generated sequence. Result: %v, Nanoseconds: %d\n", lcm, euler.Sequence(1, 20)...)
}
Exemplo n.º 2
0
func main() {
	euler.Init(19, "How many Sundays fell on the first of the month during the twentieth century (1 Jan 1901 to 31 Dec 2000)?")
	euler.PrintTime("Full specs   | Result: %v, Nanoseconds: %d\n", solution, 1901, 2000)
	euler.PrintTime("Smaller code | Result: %v, Nanoseconds: %d\n", solution2, euler.Sequence(1901, 2000)...)
	euler.PrintTime("Math         | Result: %v, Nanoseconds: %d\n", solution3, 100)
}
Exemplo n.º 3
0
func main() {
	euler.Init(17, "If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used?")
	euler.PrintTime("N = 342 | Result: %v, Nanoseconds: %d\n", solution, 342)
	euler.PrintTime("N = 115 | Result: %v, Nanoseconds: %d\n", solution, 115)
	euler.PrintTime("N = 1000 | Result: %v, Nanoseconds: %d\n", solution, euler.Sequence(1, 1000)...)
}