Project Euler 126 - Cuboid Layers

Official link:

Thought Process

My first thought is that there would be a recursive formula to solve this problem for the number of cubes needed per layer so I started doing some test cases in GeoGebra (Manually drawing out cubes and counting them) and I got the following results

Now Layer 1 is obvious, if we start with (a, b, c) we will require 2(ab + ac + bc) cubes to cover it. Now here are some patterns I saw

Which is exactly the type of recursive structure I was hoping for, hence I made the following hypothesis:

From here I trusted blindly in my guess and just brute forced the answer. 

Just generate all levels of all cubes such that each level has less than 20,000 cubes (This was arbitrarily chosen and increased till I got the correct answer), after generation return the first value that occurs 1,000 times.

Interactive Code

Input an Integer (yourinput)

Code will output the least value of n such that C(n) = yourinput (Subject to the 20,000 cubes constraint stated above)