Created
July 18, 2022 19:31
-
-
Save paulojeronimo/3cc49d0d8875b8aa2625e2cdfa28c630 to your computer and use it in GitHub Desktop.
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 bash | |
cat <<'EOF' | |
If we divide 1 by 998001 we get the number ".000 001 002 003 ... 997 999 ...". | |
Look how curious: the 998 simply disappears! | |
Want proof? Read the code of this script! | |
Read more: https://www.linkedin.com/feed/update/urn:li:activity:6954872558508732416/ | |
EOF | |
printNcharsFromS() { | |
while [ $i -lt $MAX ] | |
do | |
echo -n "${S:$i:$N} " | |
i=$(($i+$N)) | |
done | |
} | |
scale=$((3*10*10*10)) | |
bigNumber=$(echo "scale=$scale; 1/998001" | bc | tr -d '\n\\') | |
i=0 N=4 MAX=4 S=$bigNumber printNcharsFromS | |
i=4 N=3 MAX=$scale S=$bigNumber printNcharsFromS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment