Created
August 7, 2014 15:00
-
-
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
This file contains 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
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