public static class NumericExtensions { public static bool IsFibonacci(this int number) { if (number == 0) return true;
var previous = 0; var current = 1; while(current < number) { var tmp = current; current += previous; previous = tmp; } return current == number; } }