Skip to content

Instantly share code, notes, and snippets.

@Wqrld
Created May 27, 2022 16:14
Show Gist options
  • Save Wqrld/1f3761f900005e032f9233f35df34292 to your computer and use it in GitHub Desktop.
Save Wqrld/1f3761f900005e032f9233f35df34292 to your computer and use it in GitHub Desktop.
import math
primes = [2, 3, 5, 7, 11, 13, 17, 19]
for prime in primes:
sqrt = math.sqrt(prime)
decimalpart = math.modf(sqrt)[0] # modf gets the fractional part of our float
number = int(decimalpart * 2 ** 32) # * 2^32 because we want the first 32 bits of the fractional part
print(hex(number)) # print as hex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment