Skip to content

Instantly share code, notes, and snippets.

@xtetsuji
Created August 12, 2012 14:33
Show Gist options
  • Save xtetsuji/3332091 to your computer and use it in GitHub Desktop.
Save xtetsuji/3332091 to your computer and use it in GitHub Desktop.
Echo "JOJO!" if counting number is prime.
#!/bin/bash
# require: factor
# note: Debian coreutils includes factor command and using it first setup.
for((i=1;;i++)) ; do factor $i | grep -E '^[0-9]+: [0-9]+$' >/dev/null 2>&1 && echo 'JOJO!' || echo $i ; sleep 1 ; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment