Created
February 24, 2017 06:30
-
-
Save tobias-khs/49bf1b1580b4345106cc849682e71150 to your computer and use it in GitHub Desktop.
Prime number generator with Bash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| print_if_same () { while read -r -a arr; do if [ "${arr[0]}" == "${arr[1]}" ]; then echo "${arr[0]}"; fi; done ; } | |
| yes | awk '{print NR}' | factor | IFS=': ' print_if_same |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment