aboutsummaryrefslogtreecommitdiff
path: root/day17/part2
diff options
context:
space:
mode:
Diffstat (limited to '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