Created
January 1, 2012 04:41
-
-
Save jakedobkin/1546271 to your computer and use it in GitHub Desktop.
Project Euler 97
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
# this is the simplest way- show all but the last 10 digits | |
print str(28433*pow(2,7830457)+1)[2357197:] | |
# which is equivalent to | |
print (28433 * 2**7830457 + 1) % 10000000000 | |
# which is equivalent to | |
print (28433 * pow(2, 7830457) + 1) % 10**10 | |
# which is equivalent to | |
print (28433 * pow(2, 7830457)) % 10**10 +1 | |
# with three arguments, pow is equivalent to (x**y) % z | |
# but i don't understand this exactly | |
print (28433 * pow(2, 7830457, 10**10)) % 10**10 +1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment