Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Created January 30, 2017 00:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fhernd/6f79d515f71e95fb954883499e4b139d to your computer and use it in GitHub Desktop.
Save Fhernd/6f79d515f71e95fb954883499e4b139d to your computer and use it in GitHub Desktop.
Generar números de Fibonacci a partir de una solución en programación funcional.
List<ulong> numsFibonacci = new List<ulong>();
Enumerable.Range(0, 200)
.ToList()
.ForEach(
i =>
{
numsFibonacci.Add(i <= 1 ? 1 :
numsFibonacci[i - 2] + numsFibonacci[i - 1]);
}
);
numsFibonacci.Take(15).Dump("Primeros 15 Números Fibonacci");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment