Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.