puzzle contents
raw puzzle

A cell can replicate into 10 copies with only 4 cuts. It is possible to obtain 11 copies with the same number of 4 cuts!

Determine the maximum number of copies that can be formed on a cell with a given N number of straight lines (cuts).

InputN > 0, integer

OutputC number of copies, integer

ExampleFor N = 3 => 7

If we have a circle and bisect it, we have two sectors. If we draw another line to form a cross we get four as the maximum. In order to keep the maximum we always need to draw a new line such that as many cells get split again. That is, for a given state \(k\) lines exist and to come in the next state with \(k+1\) lines, \(k+1\) slices will be created. That means that we simply need to sum over all the layers up to \(n\), which is

\[f(n) =1 + \sum\limits_{k=1}^{n}k = 1+\frac{1}{2} n(n+1)\]

To implement this equation, we take Ruby

def cell_division(n) 
    return n * (n + 1) / 2 + 1
puts cell_division(File.read(ARGV[0]).to_i)