Skip to content

Instantly share code, notes, and snippets.

@originalsouth
Last active November 9, 2019 09:31
Show Gist options
  • Save originalsouth/51f7ea7382fa510fb58ea9a4c61d65da to your computer and use it in GitHub Desktop.
Save originalsouth/51f7ea7382fa510fb58ea9a4c61d65da to your computer and use it in GitHub Desktop.
Enumerate a number of Belphegor numbers
#!/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
@originalsouth
Copy link
Author

See A232448 for more info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment