Last active
November 9, 2019 09:31
-
-
Save originalsouth/51f7ea7382fa510fb58ea9a4c61d65da to your computer and use it in GitHub Desktop.
Enumerate a number of Belphegor numbers
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
#!/usr/bin/env zsh | |
zmodload zsh/mathfunc | |
MAX=5 | |
DEVIL=666 | |
if [ ! -z "$1" ] | |
then | |
MAX=$((abs($1))) | |
fi | |
if [ ! -z "$2" ] | |
then | |
DEVIL=$((abs($2))) | |
fi | |
m=0 | |
i=0 | |
while [ "$m" -lt "$MAX" ] | |
do | |
zeros=$(for k in `seq $i`;do echo -n 0;done) | |
belphegor=$(echo "1 $zeros $DEVIL $zeros 1" | sed -e 's/ //g') | |
if ! openssl prime $belphegor | grep not > /dev/null | |
then | |
echo $i | |
((m++)) | |
fi | |
((i++)) | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See A232448 for more info.