Skip to content

Instantly share code, notes, and snippets.

@maxjacobson
Last active August 29, 2015 14:12
Show Gist options
  • Select an option

  • Save maxjacobson/96494f4bff5f8e3b752c to your computer and use it in GitHub Desktop.

Select an option

Save maxjacobson/96494f4bff5f8e3b752c to your computer and use it in GitHub Desktop.
package main
import "fmt"
func main() {
i := 1
for !coolNumber(i, 20) {
i++
}
fmt.Println(i)
}
func coolNumber(num int, top int) bool {
for i:= top; i >= 1; i-- {
if num % i != 0 {
return false
}
}
return true
}
i = 1
i += 1 until (@cool ||= (1..20).to_a.reverse).all? { |n| (i % n).zero? }
puts i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment