Skip to content

Conversation

@haragam22
Copy link
Contributor

🚀 Submission Checklist

  • My code is placed in the correct Languages/Go/SyntaxBasics/prime_check.go
  • My code is functional and includes necessary comments.
  • This PR addresses an existing issue.

🔗 Linked Issue

Closes #77


🧩 Description

Added a Go implementation of Prime Check under the SyntaxBasics section.
This program checks whether a number is prime using an efficient 6k ± 1 optimization, demonstrating Go’s basic syntax, loops, and conditionals.


🧠 Features

  • ✅ Clean and beginner-friendly Go code
  • 🔁 Efficient prime-checking using 6k ± 1 approach
  • 🧩 Handles numbers less than 2, small primes, and larger inputs
  • 💬 Displays result clearly with sample input/output
  • 🧠 Strengthens the Go SyntaxBasics folder with a fundamental math example

🧪 Example Run

Input:

17

Output:

17 prime? true

🖥️ Verification

Tested locally in terminal using:

go run Languages/Go/SyntaxBasics/prime_check.go

✅ Works for various test cases (e.g., 1, 2, 3, 16, 17, 23)
✅ Handles invalid or small inputs gracefully


🏷️ Commit Message

feat(Go): Add Prime Check implementation under SyntaxBasics

@haragam22
Copy link
Contributor Author

kindly review this pr for hacktoberfest 2025 at the erliest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(Golang): [Basics/Primality Test]

1 participant