Last active
December 16, 2017 16:24
-
-
Save kendrikat/ef3171531acdbd8a9e845c78340c06f9 to your computer and use it in GitHub Desktop.
advent_judge.rb
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
def adv(ga = 65, gb = 8921, n = 40000000) | |
judge = 0 | |
n.times do | |
ga = ga * 16807 % 2147483647 | |
gb = gb * 48271 % 2147483647 | |
judge += 1 if (ga & 65535) == (gb & 65535) | |
end | |
judge | |
end | |
puts adv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment