Skip to content

Instantly share code, notes, and snippets.

View marcuskaufmann's full-sized avatar

Marcus Kaufmann marcuskaufmann

View GitHub Profile

Keybase proof

I hereby claim:

  • I am marcuskaufmann on github.
  • I am marcuskaufmann (https://keybase.io/marcuskaufmann) on keybase.
  • I have a public key ASBCI3u8w_UAfaTABj017y15AjwAPxjyUVx6XEdwCvD93go

To claim this, I am signing this object:

@marcuskaufmann
marcuskaufmann / gist:52f48c9d72bd5eb5d4af2418baa60cdc
Last active May 30, 2018 18:50
Ranged prime check functions
Every function below outputs 1 if x is prime and 0 if it is not prime, but only guranteed (tested) for the given range.
The obvious presence of very small prime numbers in these functions is remarkable.
x - Range | function
0- 99 | y = mod(min(x*mod(x*mod(x, 5)*mod(x, -3), 7) - 5*mod(x*mod(x, 5)*mod(x, -3), 7), x - 8), 2)
100-199 | y = min(mod(x*mod(x*mod(x*mod(-x, -3), 5), -11), 7), mod(x, 2))
200-299 | y = min(mod(x*mod(x*mod(x^2*mod(x, 5)*mod(x, -3), -19), 7), 13), mod(x, 2))
300-399 | y = min(mod(x*mod(2*x*mod(mod(x, -13)*mod(x*mod(x, -3), 5), x), 22), 7), mod(x, 2))
400-499 | y = min(mod(x*mod(mod(x^2, -3)*mod(-2*x*mod(x, 5), 22), x), 7), mod(x, 2))