Skip to content
Prev 257485 / 398502 Next

Fibonacci

On Wed, Apr 20, 2011 at 11:42:38AM +0200, Georgina Imberger wrote:
Is it allowed to use length() function? If so, then try
the following

  Fibonacci<-c(1,1)
  while (max(Fibonacci)<500){
      Fibonacci<-c(Fibonacci, Fibonacci[length(Fibonacci) - 1] + Fibonacci[length(Fibonacci)])
  }

Petr Savicky.