Skip to content

Instantly share code, notes, and snippets.

@muety
Last active April 26, 2017 19:23
Show Gist options
  • Save muety/93a3ba758e2b47fa8d8fe7f62929f013 to your computer and use it in GitHub Desktop.
Save muety/93a3ba758e2b47fa8d8fe7f62929f013 to your computer and use it in GitHub Desktop.
Delta Karlsruhe Gewinnspiel
package main
import (
"fmt"
"time"
)
func main() {
N := int64(751395478255)
n := N
factor := int64(0)
start := time.Now()
for i := int64(2); i < n; i++ {
for n%i == 0 {
factor = i
n = n / i
}
}
if n > 1 {
factor = n
}
fmt.Printf("Largest prime factor of %v is %v\n", N, factor)
fmt.Printf("Execution time: %s\n", time.Since(start))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment