Update program.cs

250% reduction in execution time with optimized recursion