aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNat Lasseter <Nat Lasseter nathan@bytemark.co.uk>2018-11-19 23:42:30 +0000
committerNat Lasseter <Nat Lasseter nathan@bytemark.co.uk>2018-11-19 23:42:30 +0000
commit2e8936e46ecf4a6784caacbf1b10ee67f0757aa5 (patch)
tree1f052ecaa824ef6d124565ff5793eb2c1f89a6ce
parent3a46f2fdd1a69c467b68c36023d38efde5c62dac (diff)
[day17] Inspiration about day17 part2
-rwxr-xr-xday17/part219
1 files changed, 19 insertions, 0 deletions
diff --git a/day17/part2 b/day17/part2
new file mode 100755
index 0000000..1f4a94d
--- /dev/null
+++ b/day17/part2
@@ -0,0 +1,19 @@
+#!/usr/bin/env ruby
+
+input = gets.chomp.to_i
+
+length = 1
+pos = 0
+after0 = 0
+
+50_000_000.times do |num|
+ pos += input
+ pos %= length
+ pos += 1
+
+ after0 = (num + 1) if pos == 1
+
+ length += 1
+end
+
+p after0