Code for the Advent of Code event
aoc
advent-of-code
1# frozen_string_literal: true
2
3module AoC
4 # Math helper stuff
5 module Math
6 class << self
7 # @param x [Numeric]
8 # @param y [Numeric]
9 # @return [Numeric]
10 def cantor2(x, y)
11 (((x + y) * (x + y + 1)) / 2) + y
12 end
13
14 # @param x [Numeric]
15 # @param y [Numeric]
16 # @param z [Numeric]
17 # @return [Numeric]
18 def cantor3(x, y, z)
19 cantor(cantor(x, y), z)
20 end
21 end
22 end
23end