C#
#pex4fun Challenge 2nd Fibonacci
05 months ago
Pex is Automated White box Testing for .NET from Microsoft Research.
Pex for fun on the web is a radically simplified version of the fully featured Pex Power Tool for Visual Studio.
Challenge Fibonacci 2 is a kind of the simplest recursive problem after you find out the duel is actually second order Fibonacci array.
using System;
public class Program {
public static int Puzzle(int x) {
// Can you write code to solve the puzzle? Ask Pex to see how close you are.
if (x <= 1) return x;
if (x == 2) return 3;
return Puzzle(x-1)*2 - Puzzle(x-3);
}
}
