Skip to content

Geometric progression

4 messages · Andre Nathan, Charilaos Skiadas

#
Hi

I'm pretty sure there's some built-in function to do the equivalent of
this, but I couldn't find one anywhere:

gp <- function(init, mult, n)
{ 
  if (n == 1)
    init
  else
    pg(c(init, init[length(init)] * mult), mult, n-1)
}
[1]    1    2    4    8   16   32   64  128  256  512 1024

Any pointers?

Thanks,
Andre
#
On Sun, 2008-02-24 at 23:26 -0300, Andre Nathan wrote:
Actually,

[1]    1    2    4    8   16   32   64  128  256  512


Andre
#
On Feb 24, 2008, at 9:36 PM, Andre Nathan wrote:

            
2^(0:9)
Haris Skiadas
Department of Mathematics and Computer Science
Hanover College
#
On Sun, 2008-02-24 at 21:39 -0500, Charilaos Skiadas wrote:
I guess it's so simple that I'd never think of that...

Thanks!

Andre