Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pabloemidio/primes-sum
Print all the pairs of prime numbers whose sum equals the number entered by the user.
https://github.com/pabloemidio/primes-sum
Last synced: about 1 month ago
JSON representation
Print all the pairs of prime numbers whose sum equals the number entered by the user.
- Host: GitHub
- URL: https://github.com/pabloemidio/primes-sum
- Owner: PabloEmidio
- License: mit
- Created: 2022-07-20T01:54:50.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-12-26T12:30:19.000Z (almost 2 years ago)
- Last Synced: 2024-10-12T12:52:03.257Z (2 months ago)
- Language: Go
- Size: 14.6 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Objective
Write a programme which will print all the pairs of prime numbers whose sum equals the number entered by the user.## What does this program doe?
Take a number by user's input and discover all prime number from 2 to it. After that, print all the pairs of prime numbers whose sum equals the number entered by the user.`.Eg 10 = 5 + 5, 7 + 3; 12 = 11 + 1, 5 + 7`
For perfomance reasons, it's done a cache of all prime numbers found.
---## How to test by yourself
```sh
$ git clone https://github.com/PabloEmidio/primes-sum
$ cd primes-sum
$ make compile
$ make exec
```---
## Some examples
```bash
[example@example ~]$ make exec
> Type a number: 50
47 + 3 = 50
43 + 7 = 50
37 + 13 = 50
31 + 19 = 50In 0h0min0s, it's was found 16 primes Number between 2 and 50
``````bash
[example@example ~]$ make exec
> Type a number: 100000
...
80147 + 19853 = 100000
80111 + 19889 = 100000
80051 + 19949 = 100000
80039 + 19961 = 100000
80021 + 19979 = 100000In 0h0min2s, it's was found 8918 primes Number between 2 and 100000
'
> Type a number: 0
Program ended!
```