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).
Input: N > 0, integer
Output: C number of copies, integer
Example: For 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 lines exist and to come in the next state with lines, slices will be created. That means that we simply need to sum over all the layers up to , which is
To implement this equation, we take Ruby
def cell_division(n)
return n * (n + 1) / 2 + 1
end
puts cell_division(File.read(ARGV[0]).to_i)