Skip to content

Instantly share code, notes, and snippets.

@dgjustice
Created March 25, 2022 20:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dgjustice/42558e13b7eb25341bb7d4b304926c57 to your computer and use it in GitHub Desktop.
Save dgjustice/42558e13b7eb25341bb7d4b304926c57 to your computer and use it in GitHub Desktop.
Prime number fud
END {
for ( i = 1; i < 100; i++) {
arr[i] = i
}
for (p = 2;p < 49; p++) {
for (i = p*2; i < 100; i += p) {
delete arr[i]
}
}
for ( i = 1; i < 100; i++) {
if (i in arr) {
print arr[i]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment