Skip to content

A Go program that performs prime factorization on a given integer

License

Notifications You must be signed in to change notification settings

fishnux/goprime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoPrime

GoPrime is a simple, single-threaded program written in Go, that accepts an integer as the user input and performs prime factorization on it.

Screenshot

Why?

I recently finished learning Go fundamentals. Prime numbers are cool, so I decided to build this tool. It might be able to help some people learning math! :)

Technical stuff

This was my first attempt at writing a proper Go program. There's certainly more room for enhancements/optimization:

  • More tests could be written
  • factors = append(factors, i) is resource intensive, because it allocates a new underlying array every time a factor is appended
  • performPrimeFactorization() uses fmt.Print(), so if I had created a test for it, go test would output all the factorization steps during the test. Is this okay?
  • I forgot to document my code

I might update this project from time to time with enhancements and stuff. Meanwhile, let me know your feedback! :)

About

A Go program that performs prime factorization on a given integer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages