Skip to content

Instantly share code, notes, and snippets.

@deniszh
Created August 7, 2014 15:00
Show Gist options
  • Save deniszh/f7a91ffc0327f2402a9a to your computer and use it in GitHub Desktop.
Save deniszh/f7a91ffc0327f2402a9a to your computer and use it in GitHub Desktop.
Google hiring task (first 10-digit prime in e) in bash one-liner
e=$(BC_LINE_LENGTH=0 bc -l <<<"scale=1000;e(1)"|sed 's#\.##');for i in {0..990};do a="${e:$i:10}";[ "$(factor $a | cut -d' ' -f2)" == "$a" ]&& echo $a;done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment