aboutsummaryrefslogtreecommitdiff
path: root/day17/part2
blob: 1f4a94df9b6448242ebb4f81b108b32976397e90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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