<p>This is a hugely interesting, and very hard, problem area. It will probably take you months to read enough to even understand how to attack the problem. Here's a few things that might help you get started, and they are more to show the problems you will face than to provide solutions:</p>

<p><a href="http://karpathy.github.io/2015/05/21/rnn-effectiveness/" rel="nofollow">http://karpathy.github.io/2015/05/21/rnn-effectiveness/</a></p>

<p>Then read this, and related papers:</p>

<p><a href="https://arxiv.org/pdf/1410.5401v2.pdf" rel="nofollow">https://arxiv.org/pdf/1410.5401v2.pdf</a></p>

<p>Next, you probably want to read the classic papers in program synthesis and generation at the parse tree/AST level (mostly out of MIT, I think, in the early 90s.)</p>

<p>Best of luck. This is not trivial.</p>
How to write a program that outputs source code
<p>This might not be the right place for this to ask, but I am interested in artificial neural networks and want to learn more.</p>

<p>How do you design a network and train it on source code so it can come up with programs for, for example, easy number theory problems?</p>

<p>What's the general name of this research field?</p>