From 2e8936e46ecf4a6784caacbf1b10ee67f0757aa5 Mon Sep 17 00:00:00 2001 From: Nat Lasseter Date: Mon, 19 Nov 2018 23:42:30 +0000 Subject: [day17] Inspiration about day17 part2 --- day17/part2 | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 day17/part2 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 -- cgit v1.2.3