Created
May 27, 2022 16:14
-
-
Save Wqrld/1f3761f900005e032f9233f35df34292 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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